Page 1 of 1

Chatgpt script

Posted: 28 May 2025 00:37
by kelwin
I asked chatgpt for "xyplorer script to move all .zip files from one drive to another drive with same folder structure"

when I save it as a .xys file, and run script, nothing happen

CHATGPT:

// Define source and destination drives
sourceDrive := "D:\"; // Change this to your source drive
targetDrive := "E:\"; // Change this to your target drive

// Step 1: Get list of all .zip files in source drive recursively
zipList := folderreport("files", "r", sourceDrive, , , "*.zip", , 1);

// Step 2: Loop through each file and move it
foreach(zipFile, zipList, <crlf>) {
// Get relative path of zip file from source
relPath := substr(zipFile, len(sourceDrive));

// Get target path by appending relative path to target drive
targetPath := targetDrive . relPath;

// Create target folder if it doesn't exist
makepath(getpath(targetPath, "p"));

// Move the file
move(zipFile, targetPath, 2); // 2 = move and overwrite if exists
}

text "Done moving .zip files!";



Any help correcting would be appreciated

(the drives are correct)

Re: Chatgpt script

Posted: 28 May 2025 01:33
by highend
Absolutely nonsense...

Code: Select all

$sourceDrive = "D:\";
    $targetDrive = "E:\";

    $zipList = quicksearch("*.zip", $sourceDrive, , "s");
    moveto $targetDrive, $zipList, $sourceDrive, 1+2, 1, 2, 1, 0, 0, 1, 0, 0;
    text "Done moving .zip files!";

Re: Chatgpt script

Posted: 28 May 2025 08:46
by kelwin
thanks highend. I'll give that a go.