Jeremy Stein - Brain
« Download multiple files | Tomcat deletes context descriptor on redeployment » |
Recursively expand compressed files
If you want to know something about a file which may be buried in a .zip or .jar file somewhere. Worse, it may be in a .war inside a .tar inside a .gz somewhere. A brute force method for finding these files is just to expand everything recursively.
Here’s a batch file for doing that with 7-Zip on Windows XP:
Name it “expand.bat”
@echo off for /r %1 %%f in (*.7z, *.zip, *.war, *.ear, *.gzip, *.gz, *.bz2, *.tar, *.rar, *.arj, *.lzh, *.z, *.cpio) do ( echo %%f "C:\Program Files\7-Zip\7z.exe" x -y -o"%%f-expanded" "%%f" > nul rem del "%%f" call expand.bat "%%f-expanded" )
It takes one parameter with the path.
Uncomment the del
if that’s what you want it to do. You may want to change the pattern list it’s looking for. In my case, I didn’t want all the .jars. This correctly handles spaces in filenames on XP. NT and 9x work differently.
It’s probably easier to do this with cygwin’s find rather than a Windows batch file.
No Comments
Be the first to comment!
« Download multiple files | Tomcat deletes context descriptor on redeployment » |
Leave a Reply