[windows2000] Re: Batch File Help

  • From: "Sullivan, Glenn" <GSullivan@xxxxxxxxxxxxxx>
  • To: <windows2000@xxxxxxxxxxxxx>
  • Date: Mon, 21 Jun 2004 11:16:07 -0400

Sure...
 
FORFILES from the resource kit:
 
forfiles -pc:\ -s -c"del @PATH\@FILE"
 
replace the -pc:\ with -p<Path to Backups>
 
The delete will try to execute for the directories, but the DEL command
does not remove directories, so it will error out.
 
The other way is:
 
xcopy c:\backups c:\newbackups /t /e
rd /q /s c:\backups
ren c:\newbackups Backups
 
The xcopy command creates an empty directory structure mirror.  Then
remove the old directory and files, and rename the new one to match the
new one...
 
HTH,
 

Glenn Sullivan, MCSE+I  MCDBA
David Clark Company Inc. 

 

________________________________

From: windows2000-bounce@xxxxxxxxxxxxx
[mailto:windows2000-bounce@xxxxxxxxxxxxx] On Behalf Of Greg Reese
Posted At: Monday, June 21, 2004 11:02 AM
Posted To: Windows 2000
Conversation: Batch File Help
Subject: [windows2000] Batch File Help



I need to make a batch file that will delete all files in a bunch of
subdirectories but leave the subdirs in place. 

This is for the backup file on my SQL server. 

The directory is d:\MSSQL\Backup then there is a subdir for each
database.  I want to clear out all those sub directories.

My best thought was to delete the entire backup folder, then copy in an
empty one that has all the subdirectories in it.

Is there a more efficient way to do this? 

Greg 

Other related posts: