x243 Posted March 20, 2005 Share Posted March 20, 2005 I have a program that generates a random directory name (in a subdirectory of the program) with files in it everytime it runs an automated backup. I have a scheduled batch file that copies the contents of this backup directory to a network share. The program will not allow just putting the backup files in a network share to begin with, so I have to use this batch file to copy the files there. Anyways, once I xcopy the files to the network share, I need a way to get rid of the original local files. Since the backup folder name changes (unpredictably) with each backup, I need something that works like DELTREE but for Win2k/XP/2003. If I use the DEL command, I can get rid of files, but the entire subdirectory structure is still there. I cannot find anything that gives me RD.EXE functionality AND support for wildcards. No combinations of RD and DEL work. Someone out there has to have the solution! Thanks in advance. Link to comment Share on other sites More sharing options...
x243 Posted March 20, 2005 Author Share Posted March 20, 2005 I found the solution, but not from any help of this forum's search features. I found it on Google and then found references at MSFN down the page. The program is just called Delete.exe. In order for it to do what I wanted, I had to have it run the same command twice- once to remove the files in the subdirectories and then again to remove the subdirectories themselves. You can get it here (del210.zip): http://sac-ftp.gratex.sk/utilfile16.htmlThe homepage has dead links to it. Link to comment Share on other sites More sharing options...
un4given1 Posted March 20, 2005 Share Posted March 20, 2005 Why didn't you just use the MOVE command? Link to comment Share on other sites More sharing options...
x243 Posted March 20, 2005 Author Share Posted March 20, 2005 Why didn't you just use the MOVE command?<{POST_SNAPBACK}>Doesn't work either. I can't even get the MOVE command to recognize the subdirectories there. * and ? wildcards don't get anywhere even though the random folder names start with the number 2, but that is the only common thread among them. Link to comment Share on other sites More sharing options...
IcemanND Posted March 21, 2005 Share Posted March 21, 2005 Change c:\backups to your network share location.Then this will copy the contents of all of the folders located in the same directory as itself to your share and then remove the folder and it's contents.setlocal ENABLEEXTENSIONSfor /f "usebackq" %%d in (`dir /AD /b`) do (echo %%d if /I "%%d" NEQ "." ( if /I "%%d" NEQ ".." ( xcopy %%d\*.* c:\backups rd /s /q %%d ) )) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now