Notifications
Clear all

[Closed] Help for a script

Hi,
i’m tryng to make a script that will extract all the zip and rar file on a folder with the( zip or rar) name and move all the files on subfolder on the root of the main new created folder.
Unfortunately i don’t know where to start because i don’t think it’s possible interact with External files only through maxscript and i’m kinda new to it.

I wrote this like a guide line if could help

for i in "folder_path" where i.name == ("*.zip"; "*.rar") do (
extract i to "New_zip/rar_File_Name_Folder"
move i to "New_zip/rar_File_Name_Folder"
Check for subfolder and move all file inside them to directory

renamer() here will rename all the files name 

for o in "New_Folder_Path" where o.name != newfolder.name+"*" do (
delete o

thanks

3 Replies

You can try and use dotNet:

IOCompression = dotNetClass "system.io.compression"
IOCompression.ZipFile.ExtractToDirectory "zipPath" "directory"

Not sure if the above will work as I can’t test it as I’m on my phone but worth a try.

thanks but it gives me an error:

undefined
– Error occurred in anonymous codeblock; filename: ; position: 214; line: 2
– Unknown property: “ZipFile” in undefined

got a chance to actually test it out:

DotNet.LoadAssembly "System.IO.Compression"
zip = DotNetClass "System.IO.Compression.ZipFile"
result = zip.ExtractToDirectory "zip path" "directory path"
print( result )

That should work for standard zip files