Multi Commander > Script
7-zip profiles vs cmd line 7-zip?
Ulfhednar:
Yes the idea was to scan subfolders; zip specifically named folders; delete those source zipped folders, leaving the 7z in their place & log operations.
(a & b were just placeholders for my test before giving it actual pathing)
I was thinking of adding a StrIsRegExpMatchNoCase or similar to delete redundant files recursively. Basically a tidy up operation on a number of subfolders.
I got this, but the DeleteFiles instruction hangs the debugger & MC with a deletion dialog, tried with & without {}s on the last instruction. Also tried SILENT to no effect ???
Am I missing sth or is this a bug?
--- Code: ---@var $currentPath = GetSourcePath();
@var $Items = GetSourceItems();
@var $count = arrayCount($Items);
@var $curItem;
@var $fullFilename;
@var $array2[];
// Loop all items in the $Items array
for( $n = 0; $n < $count; $n++)
{
$curItem = $Items[$n];
$fullFilename = $currentPath ^ $curItem;
@var $isMatch = StrIsRegExpMatchNoCase($fullFilename, "[a-z0-9]{30}");
if($isMatch)
{
arrayAdd($array2, $curItem);
}
}
@var $options[] = {"NODIALOG"};
DeleteFiles($array2, $options);
--- End code ---
Thanks in advance for looking at this
Mathias (Author):
--- Quote from: Ulfhednar on February 09, 2025, 14:04:04 ---Yes the idea was to scan subfolders; zip specifically named folders; delete those source zipped folders, leaving the 7z in their place & log operations.
(a & b were just placeholders for my test before giving it actual pathing)
I was thinking of adding a StrIsRegExpMatchNoCase or similar to delete redundant files recursively. Basically a tidy up operation on a number of subfolders.
I got this, but the DeleteFiles instruction hangs the debugger & MC with a deletion dialog, tried with & without {}s on the last instruction. Also tried SILENT to no effect ???
Am I missing sth or is this a bug?
--- Code: ---@var $currentPath = GetSourcePath();
@var $Items = GetSourceItems();
@var $count = arrayCount($Items);
@var $curItem;
@var $fullFilename;
@var $array2[];
// Loop all items in the $Items array
for( $n = 0; $n < $count; $n++)
{
$curItem = $Items[$n];
$fullFilename = $currentPath ^ $curItem;
@var $isMatch = StrIsRegExpMatchNoCase($fullFilename, "[a-z0-9]{30}");
if($isMatch)
{
arrayAdd($array2, $curItem);
}
}
@var $options[] = {"NODIALOG"};
DeleteFiles($array2, $options);
--- End code ---
Thanks in advance for looking at this
--- End quote ---
Hang the debugger ? hmm any error dialog that popup behind MC maybe ?
this work for me
--- Code: ---@var $deleteOptions[] = {"NODIALOG"};
@var $files[] = {"R:\\Target\\File.zip", "R:\\Target\\File1.zip", "R:\\Target\\File2.zip"};
DeleteFiles($files, $deleteOptions);
--- End code ---
Ulfhednar:
Thanks for the reply Mathias.
Using your code works i.e. giving the instruction a fixed path for items, when I try to get it to work calling the items in my filtered array, it hangs.
The debugger has the red highlight active on the last line but clicking on anything fails to advance the operation.
The only window that shouldn't be present is the hung dialog. (See attached) No error dialogs or windows.
All MC dialogs will minimize but won't finish the op, restart req'd.
Is it related to how the path/filename is being added to the array? the $fullfilename is correctly enumerated in the debugger showing the whole string.
Mathias (Author):
Not sure why i hangs for you. it is strange.. all file operations are handled in background threads.
Can you give me a script that fails and a list how with how the the file structure should be for the script. Then I can test using the same file structure as you.. if it is something with the files or script
Ulfhednar:
Sorry for destroying your Monday morning Mathias.
You pointed me in the right direction.
So I realized what was wrong finally!
I'd used
--- Code: ---@var $Items = GetSourceItems();
--- End code ---
but should have used
--- Code: ---@var $Items = GetSourceItems(1);
--- End code ---
::)
Thanks for the assist :)
A bit OT:-
https://multicommander.com/Docs/multiscript/functions/filesystem#deletefiles
Shows RECYLE, should this be amended to RECYCLE? It doesn't appear in the $options debugger output.
If I add NODIALOG & RECYLE it doesn't send to the recycle bin. I thought it would ???
Lastly .... how do you script to recurse subdirs from GetSourcePath etc?
Navigation
[0] Message Index
[*] Previous page
Go to full version