TPWW Forums  

Go Back   TPWW Forums > o t h e r > computer help forum

 
 
Thread Tools Display Modes
Old 12-19-2003, 08:54 AM   #1
road doggy dogg
Guest
 
Posts: n/a
Small DOS command question

Okay I made a small batch file on my PC that basically just deletes a lot of temporary files and the like. Like temp. internet files, and temp. files that are caused by programs that aren't deleted and the like (Cool Edit Pro does this a lot )

In the file I just use basically "deltree /y C:\folder\*.pk" for instance, and that's all fine and dandy

For whatever reason though, it doesn't delete the files in the folder's subfolders.

Like on my PC, the line is "deltree /y c:\Tony\*.pk", but the files I want are scattered around in the c:\Tony\sounds subfolders, and since I'm constantly re-arranging the folders in there, I'll probably forget to add the different folder names to the file, so instead I'd just like it to delete all the .pk files in the subfolders automatically.

Is there a parameter to add to deltree to make it add to the subfolders as well? 'Cause I thought it just did the folder and everything in it already, but none of the files are getting deleted so I dunno
 
Old 12-19-2003, 08:22 PM   #2
CREDO
Gruddammit!
 
CREDO's Avatar
 
Posts: 6,075
CREDO is "reptacular" (2,500+)CREDO is "reptacular" (2,500+)CREDO is "reptacular" (2,500+)
One need only type “deltree /?” to see a parameter list, but the answer to your question is simple. Deltree is designed to delete folders and subfolders recursively and files in those folders and subfolders, hence the name deltree as in branches of folders and subfolders in the form of a tree. You are not using deltree correctly. Deltree is supposed to have a directory as a parameter not a file, or in this matter (*.pk) which is a pattern for files.

All you need to type is “deltree /y c:\folder” and that will delete that folder including all the subdirectories. Or you can simply say “deltree /y c:\folder\.” That’s a fullstop at the end, meaning delete everything in the directory “folder”, including subfolders and files, but not “folder” itself. There is always the command “mkdir” if a directory needs to be created afterwards, but this should not be necessary using the previous method.

The DOS command “del” is for deleting files, again typing “del /?” will give one a list of possible parameters. You will see the switch /s which instructs the command to “delete specified files from all subdirectories”, therefore, using the command “del /f /s c:\folder\*.pk” will delete all the files in directories and subdirectories in the folder “folder”. The /f switch is simply to “force deleting of read-only files”.

Remember using deltree will delete folders and files recursively in a specified folder. Del is designed to delete files.

So in his batch file you can use:

----- Batch File Starts Here ---------
REM The following line deletes all pk files in the directory “folder” and in all subdirectories
del /f /s c:\folder\*.pk
------ Batch File Ends Here ------



I am the Law
CREDO is offline  
Old 12-19-2003, 10:05 PM   #3
road doggy dogg
Guest
 
Posts: n/a
Well first off, many many thanks for the help


Howeeeeever When I tried that, I got an "Invalid switch - /F" message. Is my version of DOS too old? (I got a similar message if I just used the /s)

When I did the del /? in the DOS prompt, the only parameter thing that showed up was /P, to prompt if you wanted to delete the files
 
Old 12-20-2003, 02:01 AM   #4
CREDO
Gruddammit!
 
CREDO's Avatar
 
Posts: 6,075
CREDO is "reptacular" (2,500+)CREDO is "reptacular" (2,500+)CREDO is "reptacular" (2,500+)

http://members.iinet.net.au/~gazza13/apps/DEL16.zip

Use this progam like this

Del16 /S C:\folder\*.pk

that should sort you out.



I am the Law
CREDO is offline  
Old 12-20-2003, 02:12 AM   #5
road doggy dogg
Guest
 
Posts: n/a
CREDO have I ever told you that I love you
 
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 02:14 PM.


Powered by vBulletin®