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();
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.
Copy link to clipboard
Copied
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.