Skip to main content
November 9, 2012
Question

How to delete files with backslash in name

  • November 9, 2012
  • 4 replies
  • 998 views

I had some code that was developed for a windows server to create some image files. The destination parameter had backslashes in the path. When run on a Coldfusion 9  linux server, the files ended up in the top directory with long filenames consisting of ' directory\directory\filename'.  Now I need to delete them. I've tried cffile action="delete" file="directory\\directory\\filename">.

This topic has been closed for replies.

4 replies

johnvalter88
Participant
August 2, 2019

The Longpathtool is the very best program for error, unlock solution. Try it and solved your problem. I used the long path tool and I solved my error, unlocks problem solution.

BKBK
Community Expert
Community Expert
November 11, 2012

The syntax is <cffile action="delete" file="absolute_path_to_the_file">. So what you need to do is figure out how to get the absolute path, on the basis of the current page.

WolfShade
Legend
September 19, 2016

ExpandPath() should work.

V/r,

^_^

Inspiring
November 11, 2012

Did just deleting them exactly as-is (ie: without escaping the backslashes) not work?

--

Adam

Inspiring
November 10, 2012

Execute cfdirectory on the directory in question.  Loop through the query object and use whatever field refers to the name of the file.  I'd have to look that up, but you can do that.