December 19th, 2012, 10:09 PM
Zipping files individually with unknown file type
I am trying to zip some files with an unknown file type individually. I am using the following code in a batch script to do that:
FOR %%A IN (bestbuy*nat*component.cpi*) DO "C:\Program Files\7-Zip\7z.exe" a -mx9 -m0=lzma2:d256m "%%~nA.7z" "%%A"
The code will compress files individually ONLY if the file has an extension. Unfortunately the files that I have don't have any extension. In the code I am trying to zip files by doing a pattern match, the files are getting compressed into ONE file (which I do not want, I want each file compressed individually).
Why does this code create separate zip files when the files have an extension (for example if I add .txt to the end of the files) and when there is no extension the code creates one zipped file.
Can anyone please help me with the code to compress files with unknown file type so that each file gets compressed individually
I greatly appreciate it.
December 20th, 2012, 09:45 PM
As a first thought rename the files without extension to ones with.
Use .woe for WithOut Extension. Then compress as you would others.
When you unzip them if you need to, rename them back to no extension versions.
I looked here at devshed but did not find examples how to do the rename. But there is one at stackoverflow.
Last edited by admiraln; December 20th, 2012 at 09:48 PM.
Reason: Add URL