Compressing +300 files uzing 7za to individual archives without ruining the filenames
Posted on 2004-08-08
I have Win Me, and I need to make a backup of more than 300 files, and to save a little space on the Cd, I would like to compress them using 7-zip. Since the program doesn´t have an option (like winrar) to compress files to individual archives, I decided to use the W32 command line driven version of the program.
After trial an error, and searching the web for some examples of .bat files, I found out that some thing like this would work:
For %%n in (*.*) do echo 7za a -tz7 -mx=7 %%.7z %%n>>c7z.bat
and then execute the c7z.bat file created. While the above works fine for the most part, it fails in something crucial for me. The filenames have the 8.3 filename format. So I end up with pretty unrecognizable filenames. I know I can use Winrar´s "Put each file to separate archive" option but on my trials, I found out that 7z compresses better than Winrar, so I have decided to use 7z as my compression selection.
I searched the web, and came up with different tools that I thought could or would help me out. Like Minitrue, the Berkeley utilities, aedit, even a tool called gpatch.exe, etc. But they either didn´t work or the man pages were really confusing or I just didn´t know what to do. So I thought about coming here to ask for a lot of help and expertise.
I just don´t want to type/cut and paste more than 300 entries because it would be time too time consuming. So I´m hoping to have something like this in the batch file:
7za a -tz7 -mx=7 "afilename.7z" "afilename.doc"
7za a -tz7 -mx=7 "allmydocs.7z" "allmydocs.ppt"
7za a -tz7 -mx=7 "template.7z" "template.css"
7za a -tz7 -mx=7 "allprivatedata.7z" "allprivatedata.zip"
7za a -tz7 -mx=7 "all settings.7z" "all settings.dat"
7za a -tz7 -mx=7 "my portafolio.7z" "my portafolio.7z"
7za a -tz7 -mx=7 "etc.7z" "etc.etc"
As you can see the filenames as well as the extentions are different. Although I think the command line edition of 7z is smart enough to know that spaces are part of a given filename, I would like to add the quotes to all filanames so I know the program doesn´t stop because of an error.
The only idea I had was to put all the files I want to compress to an empty directory and then do dir *.* /ogn/b>workdata.txt so I would end up with all the files and their full filenames, and then somehow do the proper modifictions, which btw don´t seem easy to me. I think it can be done, but I have no clue about what to do.
If anyone can help, or give ideas, it will be greatly appreciatte. Needless to say there are many points involved ;-)
Thannks in advance,
Ps1: if you need more information, please do let me know.
Ps2: sorry if I wasn´t clear enough. English isn´t my first language.