Computing.Net > Forums > Windows XP > modify bat file to delete directory

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

modify bat file to delete directory

Reply to Message Icon

Name: Zoltar
Date: December 13, 2007 at 11:48:28 Pacific
OS: XP Pro SP2
CPU/Ram: p4 3GHz / 1.24 G
Product: Dell
Comment:

Trying to modify a bat file to delete an existing directory and its contents - then recreate the directory and perform a back up.

The latter part works, but now that the directory exists, subsequent backups fail.

It seemed best to just do the blurb -
if exists path\directory - del path\directory
prior to mkdir and doing the backup.

What I want to know is will such a command as
If exists path\directory will work recursively down the tree of that directory killing off everything below it, so that when mkdir is executed that it will in fact create the then not existing directory and move forward with the remainder of the script.

Zoltar



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: December 13, 2007 at 11:55:36 Pacific
Reply:

if exist path\directory RD path\directory /Q /S


0

Response Number 2
Name: wanderer
Date: December 13, 2007 at 12:10:38 Pacific
Reply:

delete than backup????

Is this part of a backup script for log files? If so you should be renaming not deleting.

Imagine the power if you knew how to internet search


0

Response Number 3
Name: Zoltar
Date: December 13, 2007 at 13:29:37 Pacific
Reply:

IVO - ok, thanks will try the if exist changes you offered.

wanderer - yes deleting directory before making backup copy.

This bat file is to backup Eudora mailboxes from local machine to network drive where user has limited space.

If needed the network files are backed up each work night.

Zoltar


0

Response Number 4
Name: Mechanix2Go
Date: December 13, 2007 at 15:31:54 Pacific
Reply:

I don't much see a point in deleting then recreating DIRs.

Why not just delete the file?

del /s x:\the\stuff


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 5
Name: wanderer
Date: December 13, 2007 at 19:21:17 Pacific
Reply:

Actually I used to keep a couple of weeks worth of logs to review by just renaming the previous folder and making a new one. I would just look at the date on the folder to know what days log it contained.

Are you ready for where Microsoft wants you to go today?


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: modify bat file to delete directory

Bat file to run if file is modified www.computing.net/answers/windows-xp/bat-file-to-run-if-file-is-modified/165563.html

bat files that delete folders on C: www.computing.net/answers/windows-xp/bat-files-that-delete-folders-on-c/114070.html

Bat file to delete carriage returns www.computing.net/answers/windows-xp/bat-file-to-delete-carriage-returns/163932.html