Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
when i try to delete a file in dos with a whitespace, a dash, and another whitespace together in a filename (ex: "str1 - str2.txt"), the file wont delete. How do I get around this without renaming the file?
Command i'm using:
del /f/q "D:\www\trash\whatever - something.txt"if i try to copy the same file, it copies successfully; so it's a probably a problem with delete.
any suggestions on how i could delete this file? (without renaming, or using explorer)
thanks,
jake

Hi Jake,
What OS are you using?
Seems like xphome, since you mention explorer.
If so, which command prompt are you using, cmd.exe or command.com?
And when you do this:
del /f/q "D:\www\trash\whatever - something.txt"
do you get a message or do you simply get the prompt back and the file stays stuck.
If you get a message, it would help to post it.

Mechanix,
Yes, I'm using XP Home (it says so at the top of my post).
I'm using cmd.exe in the system32 folder.
And when I try to delete, a message is returned that says the file could not be found. But the file is there, i've dir/p'd the directory, checked my syntax, and the file exists.Thanks for the response,
Jake

A way to work around is to use the short format (8.3) name in delete. To get the short name type the Dir /X command, i.e.
Dir /X "D:\www\trash\whatever - something.txt"
then use the returned string in the old 8.3 format as operand of the Del command.

Hi Jake,
This works:
type nul > "s:\www\whatever - something.txt"
del /f/q "s:\www\whatever - something.txt"
but this does not:
type nul > "s:\www\whatever - something.txt"
attrib +h "s:\www\whatever - something.txt"
del /f/q "s:\www\whatever - something.txt"
because the file is hidden.
Your command line does not use the
dir /ahso I guess it's not hidden, UNLESS you have the environment varible 'dircmd' set to /ah
You could probably have just deleted it in Explorer, but since we're in this deep, let's keep going and solve the prob.

Hey thanks guys, I got it to work.
The reason I'm not using explorer is because i'm making a file manager in php for people who pay me to host their websites. PHP has really crappy built-in file functions that are limited in functionality, so I decided to use it's shell command to do stuff like delete, copy, etc. I wish it was as easy as using explorer.
Thanks,
Jake

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |