mrmooge88
July 23rd, 2009, 11:50 PM
Yesterday I was needing to use 7zip to pack multiple files in the same directory to multiple separate compressed archives.
I was wanting to take some files from the same directory: File1, File2, File3, ... and turn them into: File1.7z, File2.7z ... (The actual files are not sequential)
Since I was using the flag for maximum compression it was taking awhile for each file. Not wanting to babysit the computer I ended up writing a really dirty bash script to compress them individually. The script kind of worked but had a few errors in it because I typed everything out. Today I am trying to figure out how I could have wrote it better. All the files had the same extension and and I wanted each compressed file to have the same name as the original. Any tips on how it could have been improved? This was a one time use script.
date >> ~/Desktop/7z.log
cd Path/to/directory
7z a -t7z -mx9 ./File1.7z ./File1 >> ~/Desktop/7z.log
7z a -t7z -mx9 ./File2.7z ./File2 >> ~/Desktop/7z.log
I was wanting to take some files from the same directory: File1, File2, File3, ... and turn them into: File1.7z, File2.7z ... (The actual files are not sequential)
Since I was using the flag for maximum compression it was taking awhile for each file. Not wanting to babysit the computer I ended up writing a really dirty bash script to compress them individually. The script kind of worked but had a few errors in it because I typed everything out. Today I am trying to figure out how I could have wrote it better. All the files had the same extension and and I wanted each compressed file to have the same name as the original. Any tips on how it could have been improved? This was a one time use script.
date >> ~/Desktop/7z.log
cd Path/to/directory
7z a -t7z -mx9 ./File1.7z ./File1 >> ~/Desktop/7z.log
7z a -t7z -mx9 ./File2.7z ./File2 >> ~/Desktop/7z.log