I have a bzipping tool on my computer, but it only bzips files that are inside the "compress" directory. How would I make it so files inside all directories inside the compress directory are zipped?
Example
compress/image.png goes to compress/image.png.bz2
however
compress/folder/image.png stays as compress/folder/image.png
My batch file is as follows: @echo off
title bzip
echo bzip
echo All files within /compress will be compressed as a .bz2
echo.
echo Compressing file(s)...
bzip2.exe -z compress/*.*
echo.
echo Compression Completed!
pause
I hope somebody can help me!
Edit: When running the process with directories inside the compress directory, it says "permission denied".
Use for /r compress %%i in (*) do bzip2.exe "%%i"
in your batch file instead of the call to bzip2.exe
directly. bzip2 almost certainly doesn't know how to recurse through subfolders -- standard wildcard globbing libs on Windows generally don't.
Run for /?
from a Command Prompt to see more about the syntax of the for command. If you want to test the command from a prompt instead of a batch file, use 1 percent sign for the variable instead of 2.