blakerwry
Storage? I am Storage!
Hey, I'm looking for a way to use a batch file to create directories based on the current date.... this is an extention of a batch file that creates a nightly backup of a friend's files.
i tried:
however the %date% command returns slashes (ex: 1/29/2003) that will not work with mkdir.
I need some way to tokenize the information returned form %date% and replace the slashes with dashes (ex: 1/29/2003 becomes 1-29-2003)... or just use another commadn that returns usable data.
I want to keep the existing batch file cause it's what's currently in place, easy to modify, single file solution, and easy to read/understand.
if i cant end up doing all this with a batch file i will probably try to make a c++ .exe file that will take the input from %date% and format it correctly... err... actaully...possibly even make it do must of the grunt work and just have the .bat be a "front-end". But i would like to keep this a single file solution if possible... anybody got some ideas for me?
Here's the current batch file... keep in mind that I am giving this to a computer user with limited DOS exposure who will need to make changes occasionally.
i tried:
Code:
mkdir %date$
however the %date% command returns slashes (ex: 1/29/2003) that will not work with mkdir.
I need some way to tokenize the information returned form %date% and replace the slashes with dashes (ex: 1/29/2003 becomes 1-29-2003)... or just use another commadn that returns usable data.
I want to keep the existing batch file cause it's what's currently in place, easy to modify, single file solution, and easy to read/understand.
if i cant end up doing all this with a batch file i will probably try to make a c++ .exe file that will take the input from %date% and format it correctly... err... actaully...possibly even make it do must of the grunt work and just have the .bat be a "front-end". But i would like to keep this a single file solution if possible... anybody got some ideas for me?
Here's the current batch file... keep in mind that I am giving this to a computer user with limited DOS exposure who will need to make changes occasionally.
Code:
::***************************************
:: Backup script v0.9 1/29/2003 12:23am *
:: Blake Hudson [email]blake@anime-jennie.com[/email] *
::***************************************
cls
@ECHO OFF
:: change to the source directory
c:
cd\car2000
:: create a new folder with the date on the x: drive (to be implemented later)
:: copy files from current directory to x:\ (later x:\%date%\)
@ECHO :
@ECHO :
@ECHO Copying *.DBF....
xcopy *.DBF x:\ /VYFH
@ECHO :
@ECHO :
@ECHO Copying *.CDX....
xcopy *.CDX x:\ /VYFH
@ECHO :
@ECHO :
@ECHO Copying CAR.D*....
xcopy car.d* x:\ /VYFH