MSFN Forum: [CMD] Deleting Items - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[CMD] Deleting Items Rate Topic: -----

#1 User is offline   integer 

  • Newbie
  • Group: Members
  • Posts: 43
  • Joined: 16-October 03

Posted 23 October 2003 - 03:40 AM

I am trying to delete individual folders using a .cmd file I am currently working on. My problem is that I cant delete entire folders. when I use the following code to delete a folder it only deltes the contians found within:

DEL C:\WINDOWS\AppPatch
ECHO.
EXIT

1. How can I delete entire folders and there contents?

2. How can I delete certian extentions found in a folder or a drive .bmp and so on?


#2 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 23 October 2003 - 08:15 AM

This kills ur selected file extension, in this case bmp's in the folder(s)
DEL C:\folder\*.bmp
ECHO.
EXIT


This kills everything in the folder(s)
DEL C:\folder\*.*
ECHO.
EXIT


and i feeling codie, heres one for visual basic as well :rolleyes:

This kills everything in the folder(s)
Kill "c:\folder\*.*"


This kills ur selected file extension, in this case bmp's in the folder(s)
Kill "c:\folder\*.bmp"


hope i could help you my friend :)

#3 User is offline   b0r3d 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 821
  • Joined: 03-August 03

Posted 23 October 2003 - 10:10 AM

to delete a directory, first you need to delete the contents:
DEL C:\Deleteme\*.*
Then, use the Remove Directory command
RD C:\Deleteme

#4 User is offline   un4given1 

  • Elaborate Dreamer
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,796
  • Joined: 25-September 03

Posted 23 October 2003 - 10:12 AM

There is a much easier way....

rd /s /q c:\folder

:)

#5 User is offline   b0r3d 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 821
  • Joined: 03-August 03

Posted 23 October 2003 - 10:13 AM

Does the same job :)

#6 User is offline   integer 

  • Newbie
  • Group: Members
  • Posts: 43
  • Joined: 16-October 03

Posted 23 October 2003 - 11:01 AM

thx everyone for your help. I am however still having some trouble my code now looks like this:

ECHO
RD /S /Q C:\Documents and Settings\All Users\Start Menu\Programs\Accessories\Accessibility
ECHO.
EXIT

Whats wrong with my code it doesnt seem to want to run the cmd box closes before I can see an error. I could also use some links to any pdf's that I might use to learn more about this subject.

#7 User is offline   spockboy 

  • Error: Cannot display avatar
  • Group: Members
  • Posts: 32
  • Joined: 28-May 03

Posted 30 October 2003 - 06:33 AM

If you have spaces in the path, you have to surround it with quotes:

ECHO
RD /S /Q "C:\Documents and Settings\All Users\Start Menu\Programs\Accessories\Accessibility"
ECHO.
EXIT


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy