Batch file to delete old backup


Go Back   Computer Help Articles > Windows XP General
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-05-2006, 02:33 AM
Anders Hellstrom
 
Posts: n/a
Default Batch file to delete old backup

Presently I am using batch files for backing up my 4000 + work files to a
second hard drive. The batch files are executed from icons on the desktop.
The work files are stored in folder "All Data Files" and many subfolders.

To make a complete backup I use a command line:
Xcopy C:\"All Data Files" F:\"All Data Files" /c/e/h/k/r/s

To back up the files only after a certain date, I use a command line:
Xcopy C:\"All Data Files" F:\"All Data Files" /d:12-31-2005/c/e/h/k/r/s

When making a complete backup, I would like to add a line in the batch file
which will delete all subfolders and files located in folder F:\All Data
Files\..
I have tried the DOS command DEL, but I have not been able to make it work
with all subfolders and files.

My Operating System is Windows XP Home Edition with Service Pack 2.
Any help will be greatly appreciated

Anders Hellstrom










Reply With Quote
  #2  
Old 01-05-2006, 02:33 AM
billious
 
Posts: n/a
Default Re: Batch file to delete old backup


"Anders Hellstrom" <obetug@msn.com> wrote in message
news:%23j259XHEGHA.2724@TK2MSFTNGP12.phx.gbl...
> Presently I am using batch files for backing up my 4000 + work files to a
> second hard drive. The batch files are executed from icons on the desktop.
> The work files are stored in folder "All Data Files" and many subfolders.
>
> To make a complete backup I use a command line:
> Xcopy C:\"All Data Files" F:\"All Data Files" /c/e/h/k/r/s
>
> To back up the files only after a certain date, I use a command line:
> Xcopy C:\"All Data Files" F:\"All Data Files" /d:12-31-2005/c/e/h/k/r/s
>
> When making a complete backup, I would like to add a line in the batch
> file
> which will delete all subfolders and files located in folder F:\All Data
> Files\..
> I have tried the DOS command DEL, but I have not been able to make it work
> with all subfolders and files.
>
> My Operating System is Windows XP Home Edition with Service Pack 2.
> Any help will be greatly appreciated
>
> Anders Hellstrom
>


Instead of DEL, try using

RD

RD/? will show the way..

RD/s/q "foldername"

should cause "foldername" to be "softly and suddenly vanished away"

HTH

....Bill


Reply With Quote
  #3  
Old 01-05-2006, 02:34 AM
Anders Hellstrom
 
Posts: n/a
Default Re: Batch file to delete old backup

Thank you Bill,
I ended up with a batch file which includes:
Rmdir/s/q G:\"All Data Files"
Mkdir G:\"All Data Files"
Xcopy C:\"All Data Files" G:\"All Data Files" /c/e/h/k/r/s

This works just fine,
Anders

"billious" <billious_1954@hotmail.com> wrote in message
news:43ba93a0$0$31821$a82e2bb9@reader.athenanews.c om...
>
> "Anders Hellstrom" <obetug@msn.com> wrote in message
> news:%23j259XHEGHA.2724@TK2MSFTNGP12.phx.gbl...
>> Presently I am using batch files for backing up my 4000 + work files to a
>> second hard drive. The batch files are executed from icons on the
>> desktop.
>> The work files are stored in folder "All Data Files" and many subfolders.
>>
>> To make a complete backup I use a command line:
>> Xcopy C:\"All Data Files" F:\"All Data Files" /c/e/h/k/r/s
>>
>> To back up the files only after a certain date, I use a command line:
>> Xcopy C:\"All Data Files" F:\"All Data Files" /d:12-31-2005/c/e/h/k/r/s
>>
>> When making a complete backup, I would like to add a line in the batch
>> file
>> which will delete all subfolders and files located in folder F:\All Data
>> Files\..
>> I have tried the DOS command DEL, but I have not been able to make it
>> work
>> with all subfolders and files.
>>
>> My Operating System is Windows XP Home Edition with Service Pack 2.
>> Any help will be greatly appreciated
>>
>> Anders Hellstrom
>>

>
> Instead of DEL, try using
>
> RD
>
> RD/? will show the way..
>
> RD/s/q "foldername"
>
> should cause "foldername" to be "softly and suddenly vanished away"
>
> HTH
>
> ...Bill
>
>



Reply With Quote
  #4  
Old 01-05-2006, 02:35 AM
Anders Hellstrom
 
Posts: n/a
Default Re: Batch file to delete old backup


"billious" <billious_1954@hotmail.com> wrote in message
news:43ba93a0$0$31821$a82e2bb9@reader.athenanews.c om...
>
> "Anders Hellstrom" <obetug@msn.com> wrote in message
> news:%23j259XHEGHA.2724@TK2MSFTNGP12.phx.gbl...
>> Presently I am using batch files for backing up my 4000 + work files to a
>> second hard drive. The batch files are executed from icons on the
>> desktop.
>> The work files are stored in folder "All Data Files" and many subfolders.
>>
>> To make a complete backup I use a command line:
>> Xcopy C:\"All Data Files" F:\"All Data Files" /c/e/h/k/r/s
>>
>> To back up the files only after a certain date, I use a command line:
>> Xcopy C:\"All Data Files" F:\"All Data Files" /d:12-31-2005/c/e/h/k/r/s
>>
>> When making a complete backup, I would like to add a line in the batch
>> file
>> which will delete all subfolders and files located in folder F:\All Data
>> Files\..
>> I have tried the DOS command DEL, but I have not been able to make it
>> work
>> with all subfolders and files.
>>
>> My Operating System is Windows XP Home Edition with Service Pack 2.
>> Any help will be greatly appreciated
>>
>> Anders Hellstrom
>>

>
> Instead of DEL, try using
>
> RD
>
> RD/? will show the way..
>
> RD/s/q "foldername"
>
> should cause "foldername" to be "softly and suddenly vanished away"
>
> HTH
>
> ...Bill
>

Thank you Bill,
I ended up with a batch file which includes:
Rmdir/s/q G:\"All Data Files"
Mkdir G:\"All Data Files"
Xcopy C:\"All Data Files" G:\"All Data Files" /c/e/h/k/r/s

This works just fine,
Anders


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete previous loaded file? Katie Windows XP Print Fax 1 01-05-2006 06:42 AM
Cant Delete a Windows Media file Allan Windows XP Help and Support 1 01-05-2006 02:50 AM
EGroup.IEAccess.C (dialer) dtcar Windows XP Help and Support 22 01-05-2006 02:41 AM
Re: cannot delete a file of unknown file type Dark Horse Windows XP General 0 01-05-2006 02:34 AM
How do you delete a file with no extension GD Gerlach Windows XP General 1 01-05-2006 02:31 AM


All times are GMT. The time now is 04:45 AM.


Powered by vBulletin Version 3.5.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. SEO by vBSEO 2.3.2 © 2005, Crawlability, Inc.

Batch file to delete old backup