5
1
I admit this question was asked here before:
Like Zip into separate files where the person who asked didn't specify the OS he used and received no answers.
I need to separate a huge directory into multiple .zip files that are not interdependent on each other. So, instead of:
file1.zip
file2.z01
file3.z02I would like the following set of files instead:
file1.zip
file2.zip
file3.zip
Basically this is my question. I'm on OS X so a shell script or AppleScript would be the easiest way to go.
In addition, here is a guy who asked the same thing - only he wanted to create a .tar archive: How to Creating separate archives for a set of files
The answer is correct, but it will result in tar files:
for file in `ls *`; do tar -czvf $file.tar.gz $file ; done
PS: This last part is just for those of you who are fit in Keyboard Maestro:
I also tried to perform this in Keyboard Maestro, I have a "for each" action setup which determines the file paths and then triggers a shell script. The output is correct and the macro works if I paste it in the terminal (e.g. zip
/Users/me/Desktop/test /Users/me/Desktop/test.txt).
However, when I pass the two variables to the shell script in Keyboard Maestro won't work:
zip "$KMVAR_zipPath" "$KMVAR_sourcePath"
Well, have you tried replacing
tar -czvfwithzipin thetarsolution? – Daniel Beck – 2012-05-30T06:15:28.830@DanielBeck Yes, that was the first thing I tried. – patrick – 2012-05-30T07:14:44.567