set aday = %date:~3,2%
set bday = %date:~3,2%
IF %aday% GTR %bday% echo "bigger"
I am somewhat good at batch-scripting but not to this advanced level :/
What I want to do is, check if file exists in a folder, get portion of the file name and extract a number (date) and check if the date is bigger than 20 then rename the file, if not copy it.
This being renaming the file. I have the code to rename it.
code to rename - working
for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "C:\Users\%USERNAME%\Desktop\Database.accdb" "Database BACKUP "%%d-%%e-%%f.accdb
code to copy - working
copy "c:\Users\aravinds\Desktop\Database.accdb" "\\Fileserver\Everyone\ Database\Database\Database\BackUp"
Could anyone please help me with the following
- Check if file exisits with current month and year embded in its name
database - 05/23/2012.accdb
if then (above case yes since it has May & 2012), then check if the database name has date bigger than 20? (in this case, 23, so yes)
If then rename - I have code
if not copy - I have code
Thanks in advance!