Jump to content

create folder with date as name


Recommended Posts

Hey guys!

Im new to autoit, so maybe someone can help. What im trying to do is everytime i plug my f: drive, prompt me to ask if i want to back up, then if i hit yes, make a new folder on the f: drive with that days date as the name, then copy my documents folder into it. Any help is very much appreciated, thanks for your time

-genbadger

Link to comment
Share on other sites

Hey guys!

Im new to autoit, so maybe someone can help. What im trying to do is everytime i plug my f: drive, prompt me to ask if i want to back up, then if i hit yes, make a new folder on the f: drive with that days date as the name, then copy my documents folder into it. Any help is very much appreciated, thanks for your time

-genbadger

Look up the DirCopy() function in the help file. Use the _NowCalc() function or just the @YEAR/@MON/@MDAY macros to assemble the folder name.

And welcome to AutoIt.

>_<

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

ok... i think im kinda doing this right, but its naming the folder & _NowDate.... i want to get the naming right before i do the dircopy... please clear it up for me i have no clue wat to do...

thanks for the advice u guys gave me already its put me on the right track. this is all i have and im really having trouble with it iv been workin on it for hours thanks

#include <Date.au3>

DirCreate("E:\ & _NowDate")

dircopy("@mydocuments", "E:\

Link to comment
Share on other sites

ok... i think im kinda doing this right, but its naming the folder & _NowDate.... i want to get the naming right before i do the dircopy... please clear it up for me i have no clue wat to do...

thanks for the advice u guys gave me already its put me on the right track. this is all i have and im really having trouble with it iv been workin on it for hours thanks

#include <Date.au3>

DirCreate("E:\ & _NowDate")

dircopy("@mydocuments", "E:\

This may help.

;
#include <Date.au3>

DirCreate("E:\" & @YEAR & @MON & @MDAY)

DirCopy(@MyDocumentsDir & "\MyMusic", "E:\" & @YEAR & @MON & @MDAY)

ConsoleWrite(@MyDocumentsDir & "\MyMusic" & @CRLF)
ConsoleWrite("E:\" & @YEAR & @MON & @MDAY & @CRLF)
ConsoleWrite("E:\" & _NowDate() & @CRLF)
;
Link to comment
Share on other sites

This may help.

;
#include <date.au3>

DirCreate("E:\" &amp; @YEAR &amp; @MON &amp; @MDAY)

DirCopy(@MyDocumentsDir &amp; "\MyMusic", "E:\" &amp; @YEAR &amp; @MON &amp; @MDAY)

ConsoleWrite(@MyDocumentsDir &amp; "\MyMusic" &amp; @CRLF)
ConsoleWrite("E:\" &amp; @YEAR &amp; @MON &amp; @MDAY &amp; @CRLF)
ConsoleWrite("E:\" &amp; _NowDate() &amp; @CRLF)
;

Well the code in my first reply didn't work, so I deleted it. Then I came up with this -

#Include <date.au3>
$text = StringReplace("C:\" &amp; _NowDate(), "/", "_")
DirCreate($text)

but your code is much better looking..<br><br>BTW, I used C because E is my CD drive..<br></date.au3></date.au3>

Edited by snowmaker

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Well the code in my first reply didn't work, so I deleted it. Then I came up with this -

#Include <date.au3>
$text = StringReplace("C:\" &amp; _NowDate(), "/", "_")
DirCreate($text)

but your code is much better looking..<br><br>BTW, I used C because E is my CD drive..<br></date.au3></date.au3>

Off topic

snowmaker

I have noticed &amp; inserted into your script, and a lot more inserted into my quoted script.

I tried to duplicate this in "Test thread"

http://www.autoitscript.com/forum/index.php?showtopic=98043&view=findpost&p=712266

without success.

Of course, while "&amp;" is there, your example script will not work.

Malkey

Link to comment
Share on other sites

Off topic

snowmaker

I have noticed &amp; inserted into your script, and a lot more inserted into my quoted script.

I tried to duplicate this in "Test thread"

http://www.autoitscript.com/forum/index....p?showtopic=98043&view=findpost&p=712266

without success.

Of course, while "&amp;" is there, your example script will not work.

Malkey

The 'ampersand' symbols were replaced with '&amp;' after I edited the post. In the original post, the code displayed correctly.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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