Jump to content

Recommended Posts

Posted

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.


Posted

%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

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%\

Posted

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.

Posted

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.html

:unsure:

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...