Chatgpt script
Posted: 28 May 2025 00:37
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)
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)