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

How to delete files with backslash in name

Guest
Nov 09, 2012 Nov 09, 2012

Copy link to clipboard

Copied

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

Views

889

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

--

Adam

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

ExpandPath() should work.

V/r,

^_^

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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
Documentation