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

copy file to trash

Explorer ,
Aug 17, 2016 Aug 17, 2016

Copy link to clipboard

Copied

I have temporarily been using the overly destructive method (.remove) to automatically delete files that I am one working with. However I would like to copy them to the trash THEN remove them.  Here's what I put together, but it's not doing the copying, instead returning the result false:

var original = new File (app.activeDocument.path+"/"+app.activeDocument.name);

var trash = new Folder ("~/.Trash");

original.copy(trash)

new File(original).remove();

TOPICS
Actions and scripting

Views

259

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
Adobe
Community Expert ,
Aug 17, 2016 Aug 17, 2016

Copy link to clipboard

Copied

Hi squirpy​,

var trash = new Folder ("~/.Trash");

Where the syntax comes from?

Which OS do you use?

I wonder:

"Folder.trash" is without a dot. Under Windows Folder.trash is a virtuell database, is readonly and the result is always null.

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 ,
Aug 17, 2016 Aug 17, 2016

Copy link to clipboard

Copied

LATEST

Sorry, I guess I left out some relevant information...

I am using OS X. I know that that is the path to the trash in the Unix shell. The '~' represents my home folder and the '.' indicates that the folder is hidden.  If I hop into terminal and type 'cd ~/.Trash' it takes me to my trash folder.

I am NOT positive that I can utilize the above path to my trash in javascript executed by photoshop, but have always had luck using these Unix paths to open files, etc.

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