Processing Ajax...
Save 25% on our desktop apps during our Black Friday/Cyber Monday sale!Save 25% on our desktop apps during our Black Friday/Cyber Monday sale, including DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!Save 25% on our desktop apps during our Black Friday/Cyber Monday sale!

Close Dialog


Close Dialog

Close Dialog

Delete Destination Folder and Move Source Folder Contents

This script will IRREVERSIBLY delete the destination folder (line 14), move the contents of the source folder (line 13) to the destination folder, then delete the empty source folder. This script is destructive so please test and use at your own risk!
Minimum Version
Created By
Keith Lammers (BFS)
Date Created
Jan 31, 2022
Date Last Modified
Jan 31, 2022

Scripted Function (Macro) Code

using System;
using System.Drawing;
using System.IO;

public static class DisplayFusionFunction
	public static void Run(IntPtr windowHandle)
		// Set the source and destination folders here
		string sourceFolder = @"C:\path\to\source";
		string destinationFolder = @"D:\path\to\destination";
		// Comment out this line and uncomment the next line if you don't want to be prompted when running the script
		bool confirm = BFS.Dialog.GetUserConfirm("This script will IRREVERSIBLY delete \"" + destinationFolder + "\" and then move \"" + sourceFolder + "\" to \"" + destinationFolder + "\". Are you sure you would like to continue?");
		// bool confirm = true;
		if (confirm)
			// Delete the destination directory (this is recursive, will delete the folder and all sub-folders!)
			Directory.Delete(destinationFolder, true);
			// Move the source to the destination (note this moves the contents of the source folder into the destination folder,
			// it does not move the source folder itself but it will remove the empty source folder when done)
			Directory.Move(sourceFolder, destinationFolder);