Multi Commander Support Forum

Multi Commander => Script => Topic started by: total_annihilation00 on November 11, 2025, 18:46:58

Title: MultiScript For Recursively Deleting Files Inside Folder (incl. SubDirectories)?
Post by: total_annihilation00 on November 11, 2025, 18:46:58
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: [Select]
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;

And before that this:
Code: [Select]
@var $filename = "C:\\Users\\dell\\Downloads\\thumbstick\\Silo\\*";
@var $options[] = {"RECYCLE"};
DeleteFile( $filename, $options );

P.P.S: Nevermind, I'am doing it using a PowerShell script, & using MC to call it…
Title: Re: MultiScript For Recursively Deleting Files Inside Folder (incl. SubDirectories)?
Post by: Mathias (Author) on November 12, 2025, 08:12:02
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.