4

In coldfusion, when do files that are uploaded using the getTempDirectory() function get deleted? I'm storing a temporary file that will eventually go in a database, but I need to run some code before I push it to my database. Once it's on the database I'll want to delete it from the temp directory. How long does it stay in the temp directory?

ConfusedDeer
  • 3,335
  • 8
  • 44
  • 72

1 Answers1

7

They don't get deleted.

getTempDirectory() only returns a temp folder path for you to use (mostly from OS, unless you're running multi-instance). Neither CF nor your OS is responsible for deleting the content inside.

In Windows if you run Disk Cleanup tool, temp folder would be one of the provided selections but that's about it.

Henry
  • 32,689
  • 19
  • 120
  • 221
  • Is there a way to delete the file on the directory from cold fusion? – ConfusedDeer Jan 25 '14 at 03:44
  • 3
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-6d9f.html – Henry Jan 25 '14 at 06:49
  • We have a scheduled job that deletes files older than a specified age from certain directories. – Dan Bracuk Jan 25 '14 at 16:09
  • Thanks, I'm going to manually delete them after they've been stored in the database. The temp file directory is to do some file checking, before storing in the database. – ConfusedDeer Jan 25 '14 at 19:48
  • If it may help some readers to know (finding this now years after the comments above), Henry's link was meaning to go to the HTML page for the fileDelete function in the CF9 CFML Reference, as he was answering the OPs comment/question about hot to delete files using CF. Unfortunately, the link he offered no longer goes to that page but instead redirects to a page that loads the entire CF9 CFML Reference as a PDF, and nothing in the URL conveyed it was about fileDelete. web.archive.org helped me confirm it. – charlie arehart Aug 17 '22 at 13:37