How to Delete Files from Archive by Text File

I attempted to use the for / i loop to get 7zip to refer to the list, but it kept trying to open the text file as an archive. I'm looking for a technique to automate the deletion of the JndiLookup.class file from all log4j files that contain that class. Because they are not in a fixed location, I planned to dump the sites into a text file using PowerShell or wmi. What can I do?

Best Answered by

Dany· Answered on Feb 22, 2023

The process is comparable to renaming a file inside a zip archive. You'll need to unzip everything, create a new file or replace the existing one with the extracted data. Therefore, proceed as before but omit the problematic file.

Given the large number of log4j files scattered around the system, you can point 7zip to a relative path. It will remove the files inside the archive, which are .jar files, close them without extracting them, and zip them back up. Because, as known, the files are dispersed, there is no way, at least that we have discovered, to have 7zip recursively execute it. We thought we could have it refer to the text file that gives the locations of all the files, but it didn't work.

Although 7zip allows using a text file, such as @somelistfile.txt, it only appears to work for creating archives, not deleting files from archives.

However, suppose you insist on renaming or deleting the file without opening a temporary directory of the zip files from the archive. In that case, you may pay attention to corrupting the files on your computer.

If the invalid ZIP files or folders are no longer accessible on your computer, try to fix them to work correctly. If you simply cannot open or utilize the ZIP file or folder because it displays an error message indicating that the compressed or zipped folder or file is invalid, as seen below, proceed to restore corrupted invalid Zip files immediately.

And relax if you can't find the ZIP file on your computer or external hard drive. It was most likely removed from Downloads or was not saved in the standard location on your devices.

The simplest solution to locate your missing or invisible ZIP files or folders is to launch a dependable EaseUS Data Recovery Wizard and quickly restore them. With only three simple steps, EaseUS Data Recovery Wizard can restore all lost files such files or other data.

Use EaseUS Data Recovery Wizard to recover deleted or lost files easily and quickly.

Tutorials on how to recover lost, deleted, or formatted data from HDD, SSD, USB, SD card, or other storage media on Windows and Mac.

People Also Ask

How to Delete Files Older Than X days Automatically

Are you tired of useless files on your computer yet eating up space? Then use this simple approach to delete files older than x days using File Explorer, CMD, and PowerShell. We can also assist you in recovering accidentally lost files on Windows 11/10.


Mar 10, 2023

How to Delete Files and Folders with Exclusion Circumstances

Do you want to learn how to remove a file with an exclusion circumstance using PowerShell? Don't panic because this answer will show you how to delete numerous files with the Remove-item cmdlet and delete files that do not match the criteria.


Mar 10, 2023

The File Replication Service May Delete Files, What Can I Do

The DFS file replication may delete files; thus, you can refer to this post to learn how to avoid the circumstance by correctly using the command lines and Windows PC server. And after unintentional deletion, you can recover them with the help of the EaseUS Data Recovery Wizard.


Apr 17, 2023

Files with Spaces on the End, How to Delete

Here's how to force delete files that won't remove on your Mac: Securely empty the Trash using Terminal and third-party file deletion applications. This post might assist you if you are looking for a solution to remove files with spaces on the Mac that would not delete.


Apr 26, 2023

Can't Delete Files or Format My SD Card When It's Not Locked

When you cannot delete files on an SD card, it means your SD card is locked or under protection. You can fix this problem by reading the passage below, and we will provide some methods.


Mar 09, 2023

How to Fix It Takes a Long Time to Delete Files in Windows

Why does Windows take so long to delete files and clear the recycle bin? This problem will occur when I am trying to delete plenty of small files on Windows. How can I fix this Windows issue?


Feb 22, 2023