PC Review


Reply
Thread Tools Rate Thread

How to code a batch file to delete specific folder?

 
 
Eric
Guest
Posts: n/a
 
      26th Apr 2010

Does anyone have any suggestions on how to code a batch file to delete all
files and sub trees under following directory?
C:\Documents and Settings\Default User\Local Settings\Temp
Thanks in advance for any suggestions
Eric
 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a
 
      26th Apr 2010


"Eric" <(E-Mail Removed)> wrote in message
news:F38A46FE-E7E2-4BAF-BFFE-(E-Mail Removed)...
> Does anyone have any suggestions on how to code a batch file to delete all
> files and sub trees under following directory?
> C:\Documents and Settings\Default User\Local Settings\Temp
> Thanks in advance for any suggestions
> Eric


Here you go:
@echo off
rd /s /q "C:\Documents and Settings\Default User\Local Settings\Temp"
md "C:\Documents and Settings\Default User\Local Settings\Temp"

Whether it is a wise idea to play around with the Default User profile
folder is another question.

 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      27th Apr 2010
If any file is currently used under this directory, this batch file cannot
delete them. Does it right?
Thank you very much for suggestions
Eric

"Pegasus [MVP]" wrote:

>
>
> "Eric" <(E-Mail Removed)> wrote in message
> news:F38A46FE-E7E2-4BAF-BFFE-(E-Mail Removed)...
> > Does anyone have any suggestions on how to code a batch file to delete all
> > files and sub trees under following directory?
> > C:\Documents and Settings\Default User\Local Settings\Temp
> > Thanks in advance for any suggestions
> > Eric

>
> Here you go:
> @echo off
> rd /s /q "C:\Documents and Settings\Default User\Local Settings\Temp"
> md "C:\Documents and Settings\Default User\Local Settings\Temp"
>
> Whether it is a wise idea to play around with the Default User profile
> folder is another question.
>
> .
>

 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a
 
      27th Apr 2010
Correct. There is next to nothing that will delete a file that is currently
in use. However, it does not matter: The batch file I gave you will do what
you asked for, within the restrictions imposed by the operating system.

"Eric" <(E-Mail Removed)> wrote in message
news:CF9973A0-D89D-45AA-BFDB-(E-Mail Removed)...
> If any file is currently used under this directory, this batch file cannot
> delete them. Does it right?
> Thank you very much for suggestions
> Eric
>
> "Pegasus [MVP]" wrote:
>
>>
>>
>> "Eric" <(E-Mail Removed)> wrote in message
>> news:F38A46FE-E7E2-4BAF-BFFE-(E-Mail Removed)...
>> > Does anyone have any suggestions on how to code a batch file to delete
>> > all
>> > files and sub trees under following directory?
>> > C:\Documents and Settings\Default User\Local Settings\Temp
>> > Thanks in advance for any suggestions
>> > Eric

>>
>> Here you go:
>> @echo off
>> rd /s /q "C:\Documents and Settings\Default User\Local Settings\Temp"
>> md "C:\Documents and Settings\Default User\Local Settings\Temp"
>>
>> Whether it is a wise idea to play around with the Default User profile
>> folder is another question.
>>
>> .
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching for a Specific Update with Batch File DaDuck Windows XP Security 3 31st Mar 2009 06:57 PM
Batch Delete VB code pgarcia Microsoft Excel Programming 12 24th Sep 2008 11:27 PM
Exporting a specific key via a batch/executable file? =?Utf-8?B?TXIgQg==?= Microsoft Windows 2000 Registry 6 18th Nov 2004 09:00 PM
How to delete all the file in a folder from the code? ana Microsoft Excel Misc 1 10th May 2004 05:45 PM
Create a folder and share with specific permissions via batch? Jim Rodgers Microsoft Windows 2000 CMD Promt 1 23rd Aug 2003 05:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:13 PM.