Copy link to clipboard
Copied
How to Move or copy files from one location(folder) to another using JSX?
Copy link to clipboard
Copied
Extendscript does not seem to have a move function but it does have a copy and remove function. You can mock move by first copying and then deleting. For details on the api's see the following
https://www.indesignjs.de/extendscriptAPI/illustrator-latest/#File.html
-Manan
Copy link to clipboard
Copied
Pretty straightforward using ExtendScript File objects (learn more here).
// file you want to copy
var sourceFile = new File("/some-folder-path/file-to-copy.ai");
// where you want to copy the file to
var targetFile = new File("/folder-path-to-copy-to/copied-file.ai");
// copy the source file to the target location
sourceFile.copy(targetFile);
// delete the source file
sourceFile.remove();
A few notes about the code above...