zip files by object names in scene

I have a bunch objects in the scene and a folder with an files with a same names as objects, so i need to collect in array object names and tell maxscript to zip files with the same name.

please help me

p.s.: i know about setting object names in array by

namesArray = for s in selection collect s.name

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

which utility you used for zipping?

with WinRAR for example...

CD C:\Program Files (x86)\WinRAR\
WinRAR a arhive_name "C:\My Folder\*.jpg"

...above batch file will made arhive "arhive_name.rar" from all JPG files in "C:\My Folder".

And if i've got your question right, and if WinRAR is fine for your needs, then...

namesArray = for s in selection collect s.name
theFolder = "C:\\Tmp\\" -- replace with your source folder
theExt = ".jpg" -- replace with your file type
 
-- default install location of WinRAR:
WinRAR = "C:\Program Files (x86)\WinRAR\WinRAR"
-- command A mean ADD (create new archive)
cmd = "\"" + WinRAR + "\" A "
 
for n in namesArray where \
doesFileExist (theFolder + n + theExt) do
HiddenDOSCommand (cmd + n + " " + n + theExt) startpath:theFolder

my recent MAXScripts RSS (archive here)

barigazy's picture

Very nice example. Can you

Very nice example.
Can you show also example of archiving (similar to Maz()function) but using WINRAR or 7Zip. These two software has a far better compression then maxzip.
Thanks in advance.
Cheers and Happy New Year!

barigazy

Anubis's picture

Happy New Year!

I have not 7Zip, as for WinRAR (I showed in above example) it's syntax is very closer to Maz() function:
WINRAR A archiveFileName fileName_or_pattern

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.