Jump to content

Backup Need only new files


Recommended Posts

I know how to do this in a batch file in dos but this is my first autoit script and I would really like to learn how to do it here. I have searched all over the place but can't find what I am looking for. this is my code so far. I want to run this script once a week then on the other days compare folder 1 to the temp folder and move only the new or changed files to the dated directory. Thanks to JdeB for helping me with the create date folder he showed me how to pass a variable to the dircreate(). Thanks again JdeB.

#include <Date.au3>

;-----------------------------------------------

;variable section

;----------------------------------------------

local $size

local $dnow

local $dirdate

local $comdir

;--------------------------------------------------

;Pulls now date from date.au3 file.

Dim $dnow = _NowCalcDate()

;Set location for creation of dated directory

dim $dir = "c:\backup\"

;Creates temp folder to hold files for backing up

;DirCreate ( "c:\backup\temp" )

;Copys files from one directory to another.

DirCopy ("c:\batch\1", "c:\backup\temp" ,0)

;Create directory with todays date

;Us to remove / so date is all one string

$dirdate = (StringReplace($dnow(),"/",""))

$comdir = ($dir & $dirdate)

DirCreate($comdir)

;Copies files from temp to created date directory

DirCopy ("c:\batch\1", $comdir ,1)

;Finds the directory size for us

$size = dirGetSize ( $comdir,0)

Exit

Link to comment
Share on other sites

I know how to do this in a batch file in dos but this is my first autoit script and I would really like to learn how to do it here. I have searched all over the place but can't find what I am looking for. this is my code so far. I want to run this script once a week then on the other days compare folder 1 to the temp folder and move only the new or changed files to the dated directory. Thanks to JdeB for helping me with the create date folder he showed me how to pass a variable to the dircreate(). Thanks again JdeB.

#include <Date.au3>

;-----------------------------------------------

;variable section

;----------------------------------------------

local $size

local $dnow

local $dirdate

local $comdir

;--------------------------------------------------

;Pulls now date from date.au3 file.

Dim $dnow = _NowCalcDate()

;Set location for creation of dated directory

dim $dir = "c:\backup\"

;Creates temp folder to hold files for backing up

;DirCreate ( "c:\backup\temp" )

;Copys files from one directory to another.

DirCopy ("c:\batch\1", "c:\backup\temp" ,0)

;Create directory with todays date

;Us to remove / so date is all one string

$dirdate = (StringReplace($dnow(),"/",""))

$comdir = ($dir & $dirdate)

DirCreate($comdir)

;Copies files from temp to created date directory

DirCopy ("c:\batch\1", $comdir ,1)

;Finds the directory size for us

$size = dirGetSize ( $comdir,0)

Exit

I think this post will help I had not seen this post yet.

http://www.autoitscript.com/forum/index.php?showtopic=43978

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