Here is what I am trying to do. I know how to write the command, but I am not sure how to set up the variables. Can someone please help me?
E:
IF NOT EXIST E:\working\%YEAR%\ MKDIR E:\working\%YEAR%\
IF NOT EXIST E:\working\%YEAR%\%MONTH%\ MKDIR E:\working\%YEAR%\%MONTH%\
Any help would be great. Thank you.
Page 1 of 1
Batch Help Any help would be great!
#2
Posted 11 January 2008 - 12:49 PM
what format do you want %year% and %month% to return?
#3
Posted 11 January 2008 - 01:35 PM
YYYY for the Year
MM for the Month (01, 02, 03, etc)
MM for the Month (01, 02, 03, etc)
#4
Posted 11 January 2008 - 01:50 PM
%date:~-4% = year
%date:~4,2% = month
This will depend upon you default date format so you may need to adjust.
%date:~-4% returns just the last four characters of %date%
%date:~4,2% returns character 5 and 6
%date:~4,2% = month
This will depend upon you default date format so you may need to adjust.
%date:~-4% returns just the last four characters of %date%
%date:~4,2% returns character 5 and 6
IF NOT EXIST E:\working\%date:~-4%\ MKDIR E:\working\%date:~-4%\ IF NOT EXIST E:\working\%date:~-4%\%date:~4,2%\ MKDIR E:\working\%date:~-4%\%date:~4,2%\
#6
Posted 14 January 2008 - 08:27 AM
ok, at 12:05 am each night, I move log files into the created folder above. On the first of each month (at 12:05 am) I will be moving the last log of the previous month, but it will create a folder for the new month and move it there. How I can keep this from happening or what work around can I implement? The current naming format of the logs is exYYMMDD.log. Again, any help would be greatly appreciated.
#7
Posted 14 January 2008 - 11:04 AM
Not wanting to "prevent" you in any way from learning how to write a batch file, mind you
, but maybe if all you have to do is copying some log files at certain date/times, you could use a pre-made solution, something like this should be right for your needs:
http://www.xs4all.nl...rror/index.html

If you want to write your own batch file, you should have a look at this site:
http://www.robvanderwoude.com/
where you can find lots of examples and "tricks".
jaclaz
http://www.xs4all.nl...rror/index.html
If you want to write your own batch file, you should have a look at this site:
http://www.robvanderwoude.com/
where you can find lots of examples and "tricks".
jaclaz
- ← getting Video info from video files
- Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
- DLL Invokation using an Application. →
Share this topic:
Page 1 of 1



Help
Back to top









