hvyhttr Posted January 11, 2008 Share Posted January 11, 2008 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. Link to comment Share on other sites More sharing options...
IcemanND Posted January 11, 2008 Share Posted January 11, 2008 what format do you want %year% and %month% to return? Link to comment Share on other sites More sharing options...
hvyhttr Posted January 11, 2008 Author Share Posted January 11, 2008 YYYY for the Year MM for the Month (01, 02, 03, etc) Link to comment Share on other sites More sharing options...
IcemanND Posted January 11, 2008 Share Posted January 11, 2008 %date:~-4% = year%date:~4,2% = monthThis 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 6IF 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%\ Link to comment Share on other sites More sharing options...
hvyhttr Posted January 11, 2008 Author Share Posted January 11, 2008 Thank you very much...it works like a charm! Link to comment Share on other sites More sharing options...
hvyhttr Posted January 14, 2008 Author Share Posted January 14, 2008 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. Link to comment Share on other sites More sharing options...
jaclaz Posted January 14, 2008 Share Posted January 14, 2008 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/~wstudios/LazyMirror/index.htmlIf 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 Link to comment Share on other sites More sharing options...
hvyhttr Posted January 14, 2008 Author Share Posted January 14, 2008 thank you very much!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now