Multi Commander > Script
MultiScript For Recursively Deleting Files Inside Folder (incl. SubDirectories)?
total_annihilation00:
I want to use MC's MultiScript to delete the contents of a folder while keeping the folder itself intact, just delete all files and subdirectories inside it. I tried a lot of AI-generated code but it didn't work ! Is it even possible to do this via MC ? 'Cause while it says D:\\SomeFolder\\* is valid syntax, I think the asterisk (to delete the contents of the folder) is breaking the script, I'am at wits end here ! I can get MC to delete a single file, but a folder /w files and subdirectories is another thing altogether. I'd appreciate all the help I can get ! I'am not certain but I think I read somewhere that MC has removed a lot of scripting commands, especially VBScript, though I'am not sure. P.S: Perhaps using a For loop to delete the files inside ?
I tried this:
--- Code: ---Delete FILE="C:\Users\dell\Downloads\thumbstick\silotest.log" CONFIRM=YES RECYCLE=YES;
Delete FILE="C:\Users\dell\Downloads\thumbstick\Silo\" RECURSE=YES CONFIRM=YES RECYCLE=YES;
--- End code ---
And before that this:
--- Code: ---@var $filename = "C:\\Users\\dell\\Downloads\\thumbstick\\Silo\\*";
@var $options[] = {"RECYCLE"};
DeleteFile( $filename, $options );
--- End code ---
P.P.S: Nevermind, I'am doing it using a PowerShell script, & using MC to call it…
Mathias (Author):
There is no CustomCommand named "Delete"
MC.FileSystem.Delete - https://multicommander.com/Docs/customcommands_list#mc.filesystem.delete
and for MultiScript DeleteFile and DeleteFiles
https://multicommander.com/Docs/multiscript/functions/filesystem#deletefile
https://multicommander.com/Docs/multiscript/functions/filesystem#deletefiles
If you just what to delete special files. Than use MultiScript. enumerate folder and delete a found file/folder that match criteria for deletion.
total_annihilation00:
Could you perhaps give me a rudimentary practical or skeletal code example please ? The Online Documentation is far too vague and only shows how to assign the DeleteFiles to a Variable (incomplete example), nothing about how to Enumerate the Folder and Match File Criteria, then delete. There should be an offline Help Documentation PDF IMO.
Mathias (Author):
I don't have a script that does that now. I will check later if I have one that scan filesystem. It a bit complex. need to use function. and call function for each folder recursivly.
I had something that generated pdf before but it stopped working after webpage redesign and I had not had time to look into it.
but all documentation is available on github. at https://github.com/MultiCommander/MultiCommander-Documentation
total_annihilation00:
--- Quote from: Mathias (Author) on November 15, 2025, 10:01:09 ---I don't have a script that does that now. I will check later if I have one that scan filesystem. It a bit complex. need to use function. and call function for each folder recursivly.
--- End quote ---
Alright, appreciate it ! well hope it's not too complex ! But nevertheless I would love to tweak it to my needs !
--- Quote from: Mathias (Author) on November 15, 2025, 10:01:09 ---I had something that generated pdf before but it stopped working after webpage redesign and I had not had time to look into it.
but all documentation is available on github. at https://github.com/MultiCommander/MultiCommander-Documentation
--- End quote ---
Thanks a million ! 🙏
Navigation
[0] Message Index
[#] Next page
Go to full version