Skip to main content
jeremy0013
Inspiring
December 28, 2015
Answered

Delete file when done

  • December 28, 2015
  • 4 replies
  • 1215 views

I have a script that I am running through a hot folder and when it is finished I would like to delete the file from it's folder.  I have tried a few different things but to no avail I can not get it to work.  Any suggestions? Or can this be done?

This topic has been closed for replies.
Correct answer jeremy0013

GOT IT.  Thanks V.  File should have been a variable.

var file = (File("Users/mycomputer/Desktop/Hot Folder/Layout.pdf"));

file.remove();

4 replies

jeremy0013
Inspiring
February 26, 2017

Use Automator folder action . You will have to learn some basic apple script but not to complicated.

Babymac08
Known Participant
December 7, 2016

Would you care to share how you set-up a hot folder... PC/MAC...??? Wanting to do the same thing...

Thanks

jeremy0013
Inspiring
December 29, 2015

Here is what I was trying but get a File.remove is not a function.

var  docname = activeDocument.name;

var layoutDoc = (File("/Users/mycomputer/Desktop/" +  docname));

File.remove(layoutDoc);

jeremy0013
jeremy0013AuthorCorrect answer
Inspiring
December 29, 2015

GOT IT.  Thanks V.  File should have been a variable.

var file = (File("Users/mycomputer/Desktop/Hot Folder/Layout.pdf"));

file.remove();

Silly-V
Legend
December 29, 2015

have you tried File.remove() ?