|
|
|
delete files with ' - ' in filename
|
Original Message
|
Name: jake1025
Date: September 19, 2004 at 20:58:04 Pacific
Subject: delete files with ' - ' in filenameOS: xphomeCPU/Ram: 800/128 |
Comment: 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
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Mechanix2Go
Date: September 19, 2004 at 23:56:43 Pacific
|
Reply: (edit)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.
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: jake1025
Date: September 20, 2004 at 16:30:33 Pacific
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: IVO
Date: September 21, 2004 at 01:59:18 Pacific
|
Reply: (edit)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.
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: Mechanix2Go
Date: September 21, 2004 at 02:07:34 Pacific
|
Reply: (edit)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 /ah so 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.
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
Name: jake1025
Date: September 21, 2004 at 18:47:16 Pacific
|
Reply: (edit)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
Report Offensive Follow Up For Removal
|
Use following form to reply to current message:
|
|

|