1
3
FOR %i IN (*.*) DO 7z.exe a "%~ni.7z" "%i"
Does the job for each selected file.
However I've got tons of directories (with files inside them obviously) I need to pack.
Say I have d:\dir1, d:\dir2, d:\dir3, d:\dir4. I need 7zip to pack them this way:
e:\dir1.7z, e:\dir2.7z, e:\dir3.7z, e:\dir4.7z.
How do I do that in 7zip command line?
I assume for different named directories it's IN ( * . * ) instead? I tested it, it works. Just asking to be sure. – Grumpy ol' Bear – 2011-07-20T13:18:47.033
IN (*.*)
would match all the subdirectories of whats is in the current drive+folder. Using something like(<drive_letter>:\*.*)
gets all the directories in the root folder of the specified drive. In my example,d:\dir*.*
would match the directories whose names literally start with the letters "dir" in the root folder of drived:
. – martineau – 2011-07-20T14:16:17.767BTW, you can also just literally list the folders you want separated by spaces. i.e.
IN (d:\some\folder d:\another c:\stuff)
. – martineau – 2011-07-20T17:30:23.467