Chatgpt script

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kelwin
Posts: 10
Joined: 08 Feb 2012 00:05

Chatgpt script

Post 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)

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Chatgpt script

Post 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!";
One of my scripts helped you out? Please donate via Paypal

kelwin
Posts: 10
Joined: 08 Feb 2012 00:05

Re: Chatgpt script

Post by kelwin »

thanks highend. I'll give that a go.

Post Reply