- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Microsoft
- >
- Re: Monthly Backups....dos style =)
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2004 03:37 AM
тАО07-12-2004 03:37 AM
cd\
cd c:\Program Files\Winzip
for /f "tokens=2,3,4 delims=/ " %%i in ('date /t') do (
set year=%%k
set month=%%i
set day=%%j
)
wzzip c:\backup\Daily\h%month%%day%%year%.zip -r -p -t h:\*.*
I'm hoping to make monthly's now. Basically all files that were made in June '04. Is this possible?
Thanks for your help ahead of time! =)
Monty.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2004 05:34 AM
тАО07-12-2004 05:34 AM
SolutionI am assuming that u r looking for the batch file to backup all files which were created in June04 into one zip file with the name as todays date eg. h07122004.zip
Is this right??
if yes then u have to check filter the files in h:\ right now u have given it as h:\*.* which means all files..
is there a file name format used to find the files which are created for this month??
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2004 05:52 AM
тАО07-12-2004 05:52 AM
Re: Monthly Backups....dos style =)
It sounds like it might be an awfully big Dos task to filter, and if so then I can just do it manually.
Thanks again for your time! =)
Monty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2004 06:00 AM
тАО07-12-2004 06:00 AM
Re: Monthly Backups....dos style =)
this can be achieved using the windows scripting.. wait for the next post.. i will get it ..
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2004 10:41 AM
тАО07-12-2004 10:41 AM
Re: Monthly Backups....dos style =)
If you run the monthly one each month, at the start of the month, it will be easy to create the batch file (See example 1).
If you are going to run the monthly from within your daily backup script, it will take more work (See example 2).
Example 1 (run after end of month)
--------------
cd\
cd c:\Program Files\Winzip
for /f "tokens=2,3,4 delims=/ " %%i in ('date /t') do (
set year=%%k
set /a month=%%i-1
if %month% < 10 set month=0%month%
set day=%%j
)
wzzip c:\backup\Monthly\h%month%_%year%.zip -r -p -t c:\backup\Daily\h%month%*%year%.zip
---------------------------
Example 2 (run during every backup)
------------
cd\
cd c:\Program Files\Winzip
for /f "tokens=2,3,4 delims=/ " %%i in ('date /t') do (
set year=%%k
set month=%%i
set day=%%j
)
if %month%==1 set chk_day=31
if %month%==2 set chk_day=28
if %month%==3 set chk_day=31
if %month%==4 set chk_day=30
if %month%==5 set chk_day=31
if %month%==6 set chk_day=30
if %month%==7 set chk_day=31
if %month%==8 set chk_day=31
if %month%==9 set chk_day=30
if %month%==10 set chk_day=31
if %month%==11 set chk_day=30
if %month%==12 set chk_day=31
if chk_day==day do (
wzzip c:\backup\Monthly\h%month%_%year%.zip -r -p -t c:\backup\Daily\h%month%*%year%.zip
)
----------------------------
The above batch file will NOT handle leap years. That will require additional calculations on the year. Also, the "set /a" command is only available on windows 2000, XP and 2003. If you are NOT running one of the above OS's, you will have to run the script manually.
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2004 05:12 PM
тАО07-12-2004 05:12 PM
Re: Monthly Backups....dos style =)
if chk_day==day do (
wzzip c:\backup\Monthly\h%month%_%year%.zip -r -p -t c:\backup\Daily\h%month%*%year%.zip
)
Should be:
if %chk_day%==%day% do (
wzzip c:\backup\Monthly\h%month%_%year%.zip -r -p -t c:\backup\Daily\h%month%*%year%.zip
)
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2004 02:17 AM
тАО07-13-2004 02:17 AM
Re: Monthly Backups....dos style =)
Thanks for this. I just tried it and it ran very quickly. It turned out that no zip file was made. Anyway thanks for the reply and the work done on this.
Monty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2004 04:08 AM
тАО07-13-2004 04:08 AM
Re: Monthly Backups....dos style =)
If so, then it won't create a zip file until the last day of the month.
The design was to allow you to run it during the month in your standard backup script, but at the end of the month (when chk_day = the last day of the month 30,31, etc) that a complete Monthly backup file would be created, containing ALL of the previous zip file backups from the entire month.
This also assumes that a "monthly" folder had been created at c:\backup\monthly to contain the zip file. If c:\backup\monthly does not exist, then at the end of the month, this script will fail with a file not found error, or something like it.
Make more sense?
Jon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2004 04:14 AM
тАО07-13-2004 04:14 AM
Re: Monthly Backups....dos style =)
Monty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2004 05:42 PM
тАО07-13-2004 05:42 PM
Re: Monthly Backups....dos style =)
Just change the wzzip line to point back to your data folder on H:\ as it was originally.
if %chk_day%==%day% do (
wzzip c:\backup\Monthly\h%month%_%year%.zip -r -p -t h:\*.*
)
Jon