Author Topic: MultiScript For Recursively Deleting Files Inside Folder (incl. SubDirectories)?  (Read 56 times)

total_annihilation00

  • Active Member
  • ***
  • Posts: 131
  • Tech Savant\ Envisioneering
    • View Profile
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…
« Last Edit: November 11, 2025, 21:13:03 by total_annihilation00 »
~The World's Deceit Has Raped My Soul, We Melt The Plastic People Down Then We Melt Their Plastic Town~


Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4789
    • View Profile
    • Multi Commander
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.