• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Ae javascript, move file to new folder

Guest
Dec 05, 2012 Dec 05, 2012

Copy link to clipboard

Copied

Dear sir:

I want to move a file (such: "c:\\test.txt") to a new folder, I use javascript:

var object = new ActiveXObject("Scripting.FileSystemObject");

var file = object.GetFile("C:\\test.txt");

file.Move("d:\\");

But this is not work? Can somebody tell me how?

Thank a lot!

Sincerely Yours

Ze-Yi  Hsu

TOPICS
Scripting

Views

4.1K

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 ,
Dec 05, 2012 Dec 05, 2012

Copy link to clipboard

Copied

You should be able to do it like this:

var myFile = new File('/c/test.txt');

myFile.copy('/d/test.txt');

myFile.remove();

Check Adobe's JavaScript Tools Guide (available through the ExtendScript Toolkit help menu) for the file system access commands.

Dan

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
Guest
Dec 05, 2012 Dec 05, 2012

Copy link to clipboard

Copied

Dear Dan:

Thanks a lot!

Best

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
Participant ,
Dec 06, 2012 Dec 06, 2012

Copy link to clipboard

Copied

You can also use the system.callSystem() method.  Although the command string code you place inside that funciton is dependant on which OS you are running AE on, but I have found that if you are certain of the OS, it works pretty well because AE is letting the OS handle the file operation.

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
Explorer ,
Feb 29, 2024 Feb 29, 2024

Copy link to clipboard

Copied

LATEST

what if i just wanted to select the file in explorer after :
var directory = new Folder(directoryPath);
directory.execute();

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