
#7ZX CONVERTER PC ZIP#
But first, I need to delete both the original zip file, and the "filename contents" folder. With that, I can start to merge some bits. Silly how I didn’t find that until some random page on call, which I could have used I guess, showed me.
#7ZX CONVERTER PC HOW TO#
I learned how to do multiple things in a do command – ( ) seems to work. REM Test9.bat - loop, try with no subfile directory
#7ZX CONVERTER PC ARCHIVE#
I need to fix this! Currently it uses simply the archive "a" command’s "this folder and it’s contents" parameter. Now, this successfully created the right archives, with the right files (with default compression settings, which I’ll get to changing in a bit), but there is still the problem of it also adding the top level folder "filename contents" to the archive. Create new 7z files from the same names.įor %%F in (*.rar *.zip) do "C:\Program Files\7-Zip\7z" a -t7z "%%~nF".7z "%%F contents\" Now to do this along with compressing the files: This produced the required folders (eg: "ASTROFC.zip contents" as described above).
#7ZX CONVERTER PC RAR#
REM Test6.bat - unzip all the zip and rar files into "*filename* contents" foldersįor %%F in (*.rar *.zip) do "C:\Program Files\7-Zip\7z" x "%%F" -o"%%F contents"

Finally, we want it to extract these folders using 7zip to the "*filename* contents" folders: zip extensions – will be useful in a bit. REM Test5.bat - tell me what rar and zip files are in the current directory with no extension. The Microsoft site helps with this (with that, I also rename the variable "X" with "F" for file): Worked fine! Now a final thing is to get just the filename with no extension for the final 7zip file itself. REM Test4.bat - tell me what rar and zip files are in the current directory. My For loop at first should print out the filenames that I want to work on, as I’m going for rar and zip, we have: I’ve only made a few necessary batch files before, and not needed many loops. This means no accidental deletes will happen. Works perfectly – I want to make sure it is some folder with a post or prefix, since other folders might have already been extracted (I tend to leave them around sometimes). "C:\Program Files\7-Zip\7z" x ASTROFC.zip -o"ASTROFC.zip contents" REM Test3.bat - testing extracting one file I need a specific file, so I test this line too: Worked fine on my sample of zip files, for instance, my ASTROFC.zip file with one ASTROFC.exe file in it got extracted to the subdirectory ASTROFC (ending up with the file ASTROFC\ASTROFC.exe available). This is what I want to avoid 🙂įor extracting files, there was a good example in the actual 7zip help file: I wanted to check what it compressed – in this case, it created a 7zip file with the testarchive folder in addition to it’s contents. It did what it says on the tin – my sample folder was compressed. "C:\Program Files\7-Zip\7z" a -t7z testarchive.7z testarchive\ REM Test1.bat Batch file to run 7zip on a folder to 7zip it Relearning the batch scripts, here we go 🙂 First, I got this up and running: bat files to do this (it’ll also pause at the end of execution just in case you want to re-read anything).

Run the files from the directory you want the script to work on, in Windows XP you can just double click on the. They don’t contain confirmations or much in the way of error checking besides what I describe below, so be careful if you do use them. Yes, batch files are old 😀 but I don’t have another working scripting language handily installed. You’ll need the 7zip program to do this, and most of the examples here should be easily modifiable to suit needs. This is was to more tightly compact lots of random zip files I have in various places, and to stop Windows not helpfully searching them slowly whenever I did a search (I bet I can disable it, but it is useful for some vary limited amount of zip files). So, I forayed into creating a batch file to recompress lots of zip or rar files into the slightly higher compressed 7zip format.
