How to apply this command to subfolders?
bzip2.exe -z compressfolder/*.*
How should modify it so that it will开发者_如何学JAVA do its job to sub-folders of compressfolder?
You'd better to use "find" utility, however I'm not shure it is available on windows under posix environment.
However:
find compressfolder -type f -print0 | xargs -0 -n 1 bzip2 -z
This command on any *nix system will find each regular file under "compressfolder", and will run "bzip2 -z" for each of the files. If you are using cygwin or mingw (as I suppose), it should work on windows also.
This will compress every file under compressfolder, recursively:
for /r .\compressfolder %%a IN (*.*) do bzip2 -z %%a
The for /r
will recurse into each subfolder of .\compressfolder. %%a
holds each file specified by *.*
, and the part following do
runs bzip2
on each file. The above examples assumes you'll run this from the parent folder to the compressfolder. Place the line in a batch file, eg. bzip2all.bat and run it.
精彩评论