• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit Search
0

Move or copy files from one location(folder) to another using JSX

Adobe Employee ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

How to Move or copy files from one location(folder) to another using JSX?

TOPICS
Scripting

Views

82

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 14, 2022 Sep 14, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 14, 2022 Sep 14, 2022

Copy link to clipboard

Copied

LATEST

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...

  • I would include some error checking to make sure the target folder exists
  • I would also check to make sure the copy location didn't already have a file by the same name as the copy method overwrites without confirmation

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines