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

How to delete files with backslash in name

Guest
Nov 09, 2012 Nov 09, 2012

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">.

941
Translate
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
LEGEND ,
Nov 10, 2012 Nov 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.

Translate
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
LEGEND ,
Nov 11, 2012 Nov 11, 2012

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

--

Adam

Translate
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
Community Expert ,
Nov 11, 2012 Nov 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.

Translate
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
LEGEND ,
Sep 19, 2016 Sep 19, 2016

ExpandPath() should work.

V/r,

^_^

Translate
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
New Here ,
Aug 02, 2019 Aug 02, 2019
LATEST

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.

Translate
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
Resources