Multi Commander > Script

Compress (zip) Folder with todays date and time in the filename

(1/3) > >>

Mathias (Author):
Compress a predefined folder into a predefined file.

Command Type : Custom Command

MC.Filesystem.PackFiles FILES="D:\Projects\Documents\*.*" METHOD="Zip" TARGET="D:\${date:yyyy-MM-dd}_${time:HH:mm}-Documents.zip"

Pack everything in "D:\Projects\Documents" into a file name, that will be named "D:\2011-08-20_1821-Documents.zip"

Ulfhednar:
I wish to make an unpack button, first select archives then extract to parent & overwrite pre-existing files options enabled.
I wondered if I can use some MultiScript to do this.
Are there any MS commands & switches for this that would control/over-ride the Unpack dialogs default behaviour?

Something like this?

--- Code: ---MC.Explorer.Select  FILTER="*.rar *.zip"
MC.Filesystem.UnpackFiles FILES="${sourcepath}" TARGET="${sourcepath}"
--- End code ---

Which obviously doesn't work   ;D

Thanks

Jungle:
Don't know whether it is possible to disable overwrite confirmation via MC.XChangeSettings as i haven't found list of supported settings.
So as a workaround the following could be done:
1. Disable copy confirmation
2. Unpack to a temp dir
3. Copy to target
4. Enable confirmation

Mathias (Author):
No that is currently not possible. Script can not modify the copy parameters, it is planned but it a bit complex to add.

However IF you know the file name of the file you want form inside the zip you can use the MultiScript function CopyFile(..).
(Since zip is a virtual filesystem inside MC, most file system function handles zip files as it is a folder, (with some limitations))


--- Code: ---@var $srcFile = "G:\\Test\\Test.zip\\Readme.txt";
@var $targetFolder = "G:\\Test\\Test\\";
CopyFile($targetFolder, $srcFile, "NODIALOG, OVERWRITE_ALL");

--- End code ---

Ulfhednar:
Thanks for the replies.  :)
Will something like "MC.Filesystem.UnpackFiles" also be developed as a script option for the future?

Currently my quickest workaround is to open the archive in one tab & have the opposite pane set as the destination folder.  'Copy' will 'extract' to that dir, then I can delete the source archive.

I guess it may be best to invoke an external app.  Maybe I can use a button to run a cmd-line for 7zip or something.

Navigation

[0] Message Index

[#] Next page

Go to full version