Computing.Net > Forums > Disk Operating System > I need to delete a file in DOS

I need to delete a file in DOS

Reply to Message Icon

Original Message
Name: nadizo
Date: December 6, 2002 at 14:30:03 Pacific
Subject: I need to delete a file in DOS
OS: win 98
CPU/Ram: 512
Comment:

I have a .png file i cannoy delete in windows , so i was told i have to delete it in dos. I tried getting to its directory but i have no clue how. Its in
C:\program files\america online 7.0\download\idans folder\my files and the picture is in there. I have no idea how to reach that in dos . can someone please help me ? I appreciate it. Thanx


Report Offensive Message For Removal

Response Number 1
Name: Mike Newcomb
Date: December 6, 2002 at 23:58:24 Pacific
Subject: I need to delete a file in DOS
Reply: (edit)

When in dos:-
i) CD\ - puts you in the root directory

ii) DIR filename.PNG /S - searches the hdd and locates the file.

iii) CD\path - to go to directory containing file

iv) DEL file - deletes file

v) Alternatively to (iii) and (iv)
DEL \path\file

Note: If necessary you have to use truncated directory/filenames in dos, which will be shown in (ii). To do this you use the ~ character.

Good luck - keep us posted.


Report Offensive Follow Up For Removal

Response Number 2
Name: elric
Date: December 7, 2002 at 00:05:47 Pacific
Subject: I need to delete a file in DOS
Reply: (edit)

G'day,

Have you tried deleting it in Windows Explorer?? That should work unless Windows is protecting it for some reason.
If that doesn't work then try this.
1 Hit the start button.
2 Select Programs
3 Look down the list and select MS-DOS prompt
4 This will pobably put you into c:\windows
5 At the > prompt type in cd\ to get to the root directory c:
6 Type again at the c:> prompt
cd progra~1\americ~1\downlo~1\idansf~1\myfiles - all one line
7 type dir/p and you will get a list of files
8 If you find it there type
del "filename" (whatever it is)

That should do the trick. Type exit at the prompt to get back to windows.
A few words of warning.
1 If you still get the same error message; you may have to boot into DOS and delete it then.
It is the same procedure,though.
2 I'm not sure about those last two directory names (not sure about the spaces)so if you have a problem just remember that DOS has a limit of 8 characters for the directory and is made up by using the first six letters and ~(tilde shift ` on the keyboard) and 1 (hence progra~1). So you might have to make corrections for those spaces.

Hope that helps,

regards,
Peter



Report Offensive Follow Up For Removal

Response Number 3
Name: elric
Date: December 7, 2002 at 00:28:15 Pacific
Subject: I need to delete a file in DOS
Reply: (edit)

G'day,

Just had another thought- hope it doesn't confuse you too much!!
If you have a problem with the directory names, I suggest that you "step" through to the directory.
1 At the c:> prompt type cd progra~1
- we know that will work.
2 now type dir /ad
this will give you a list of subdirectories and how they are spelled in DOS. I suspect you will see americ~1 in the list.
Keep doing this for each sub directory until you to the one you want.
Also you might have to type dir/p /ad if the screen overflows- probably just as well to do that anyway.

regards,

Peter


Report Offensive Follow Up For Removal

Response Number 4
Name: - Uziel -
Date: December 7, 2002 at 12:32:59 Pacific
Subject: I need to delete a file in DOS
Reply: (edit)

Hello Nadizo, the way I use to get (then in Win98) the real DOS name for a path is like this:
open Explorer & go to: C:\program files\america online 7.0\download\idans folder\my files
Then rightclick on the folder my files and select MS DOS promt here. And then inside that
DOS prompt window do type /write this following: truename >>DosNameOfThisPath.txt
Open that new *.txt file: it should contain the shortened dos name so U can copy/paste it
into scripts or whatever. Note it maybe sounds tricky and difficoult but it takes me about 5
seconds to get the real dos name of whatever path on My hard drives into the clip-board!!

If U don't have a DOS prompt choice in the Explorers rightclick shell extension
menu, then please do copy /paste /execute the below *.reg-file to add /get that:

============AddDosPromptToTheRighClickShellExtensionMenu.reg======start======
REGEDIT4

;; ***************************
;; (For Win98[SE] & WinME) --
;; ***************************
;;
;; This reg file add "MS DOS Prompt Here" to the context menu for files/folders
;; and open a "MS DOS Prompt Here" window with the directory already changed to

[HKEY_CLASSES_ROOT\Directory\shell\DosPrompt]
@="MS DOS Prompt Here"
[HKEY_CLASSES_ROOT\Directory\shell\DosPrompt\command]
@="command.com /k cd \"%1\""
[HKEY_CLASSES_ROOT\Drive\shell\DosPrompt]
@="MS DOS Prompt Here"
[HKEY_CLASSES_ROOT\Drive\shell\DosPrompt\command]
@="C:\\WINDOWS\\command.com /k cd \"%1\""

============AddDosPromptToTheRighClickShellExtensionMenu.reg=======end=======

Now about deleting that file U mention: If it is a file U have to delete often (like log files that
get rebuild all the time) then I would make a batch-script because it would be much easier &
faster thenever I like to delete that file: Note that U don't neccessary have to know the short
DOS name of path\+file if You just put a quote character on both sides of the long name like:

=============exampel========Del_PNG.bat============start===================

@ Echo OFF
Set PATH=%windir%;%windir%\COMMAND
If NOT exist "%windir%\COMMAND\nul" GoTo _eof

::: If run from DOS: replace %windir% with the PATH where WIN is installed, usual it is:
::: C:\WINDOWS so then rather use: Set PATH=C:\WINDOWS;C:\WINDOWS\COMMAND

If exist "C:\program files\america online 7.0\download\idans folder\my files\whateverpngfile.png" GoTo _DEL
GoTo _eof

: _DEL
ATTRIB -R -A -S -H "C:\program files\america online 7.0\download\idans folder\my files\whateverpngfile.png"
:::
::: Note: I'm not sure if the ATTRIB-command supports quoted strings so rather use this:
::: ATTRIB -R -A -S -H C:\progra~1\americ~1\downlo~1\idansf~1\myfiles\whatev~1.png
:::
DEL "C:\program files\america online 7.0\download\idans folder\my files\whateverpngfile.png"
DELTREE /Y "C:\program files\america online 7.0\download\idans folder\my files\whateverpngfile.png"

: _eof
::: if run from WIN, then use: CLS, if from DOS, then instead use: EXIT
cd\
cls

=============exampel========Del_PNG.bat=============end====================

Hope this does NOT confuse U more, but actually might help U some :-)_ regard's -Uziel-
[Please post any questions U may have, Thanx]. (If You need or like to know more about
the DOS commands then check out the following exellent guide: _ >>>
_____________________________________ - " -DOS command reference guide- " -


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: I need to delete a file in DOS

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software