Jump to content

Create folders w/ date


Recommended Posts

Hi guys,

Another newbie in the forums looking for some help with a script.

basically what I would like to do is create a script that will copy a folder

to another location and then rename the copied folder with the current date.

this will be done daily.

I have been able to copy the folder using:

DirCopy("D:\Test", "C:\Test\", 0)

however i am unsure how to rename the folder to current date.

i tried:

DirCopy("D:\Test", "C:\Test\_NowDate", 0)

but that just names the folder to _NowDate

Would really appreciate your input

thx

Link to comment
Share on other sites

You can set the date and time to a variable and then replace the _NowDate

with the variable or just replace _NowDate with whatever parameters you want.

The date is unquoted by the way.

"C:\Test\" &@mon&@mday&@year

$TimeStamp = "\"&@mon&@mday&@year&@hour&@min&@sec

Hopefully that helps.

Cheers-

Edited by AutoitNew94
"You're not smart enough for me to open my inbox, so stop sending me mail."
Link to comment
Share on other sites

Hi guys,

Another newbie in the forums looking for some help with a script.

basically what I would like to do is create a script that will copy a folder

to another location and then rename the copied folder with the current date.

this will be done daily.

I have been able to copy the folder using:

DirCopy("D:\Test", "C:\Test\", 0)

however i am unsure how to rename the folder to current date.

i tried:

DirCopy("D:\Test", "C:\Test\_NowDate", 0)

but that just names the folder to _NowDate

Would really appreciate your input

thx

you can try something like

#include <Date.au3>

DirCopy("D:\Test", "C:\" & StringReplace(_NowDate(), "/", "-"), 0)
Link to comment
Share on other sites

wow you guys are quick:)

appreciate the help - AutoitNew94 & smartee

I will give it a try.

seems as though there are multiple ways of doing the same thing huh? I'm really new at autoit

this is my first time actually trying to create a script instead of just recording mouse movements.

I came up with this and it seems to work:

used the DirMove instead of DirCopy?

DirMove("D:\Test\", "C:\Test\" & @YEAR & "-" & @MON & "-" & @MDAY)

Edited by augustspies
Link to comment
Share on other sites

hey AutoitNew94,smartee or anyone else

I was wondering if I could get your help with something else.

I have a folder for example that has other folders in it:

D:\Test\

-folder 1

-folder 2

-folder 3

-etc

I would like to move 1 folder every day into:

C:\Test\

how could I set this up?

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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