ScriptMerchant Posted May 16, 2005 Share Posted May 16, 2005 Hello everyone, I am new to AutoIt this is my first script and my first post. Im tying to make a script that can parse the drive specified (including subfolders) and copy files based on a configurable date. I believe Im close but I keep getting unknown function name from the compiler the function its complaining about it _DateDiff can anyone assist?? Here is the script : Main() Func Main() Local $sPath1 = "C:" Local $sPath2 = "24HourBackUp\" Local $FileDate = "FileGetTime($hFile)" Local $GFile = "_DateTimeFormat(-1)" FileIterate($sPath1, "MyCopy") EndFunc; Main() Func FileIterate($sPath, $sCallback) Local $hFile = FileFindFirstFile("C:\" & "*.doc") If _DateDiff('D' ,$FileDate & _DateTimeFormat) = -1 Then Call(MyCopy, $sPath1 & "\" & $sFile) Local $sFile = FileFindNextFile($hFile) If @error Then ExitLoop Call($sCallback, $sPath & "\" & $sFile) EndIf EndFunc Func MyCopy() Local $sNewPath = "24HourBackUp\"; Path to copy file to FileCopy($sPath1, $sNewPath) EndFunc Link to comment Share on other sites More sharing options...
Kerberuz Posted May 16, 2005 Share Posted May 16, 2005 Hello everyone, I am new to AutoIt this is my first script and my first post. Im tying to make a script that can parse the drive specified (including subfolders) and copy files based on a configurable date. I believe I’m close but I keep getting “unknown function name” from the compiler the function its complaining about it _DateDiff can anyone assist…?? Here is the script :Main()Func Main() Local $sPath1 = "C:" Local $sPath2 = "24HourBackUp\" Local $FileDate = "FileGetTime($hFile)" Local $GFile = "_DateTimeFormat(-1)" FileIterate($sPath1, "MyCopy") EndFunc; Main()Func FileIterate($sPath, $sCallback) Local $hFile = FileFindFirstFile("C:\" & "*.doc") If _DateDiff('D' ,$FileDate & _DateTimeFormat) = -1 ThenCall(MyCopy, $sPath1 & "\" & $sFile) Local $sFile = FileFindNextFile($hFile) If @error Then ExitLoop Call($sCallback, $sPath & "\" & $sFile)EndIfEndFuncFunc MyCopy() Local $sNewPath = "24HourBackUp\"; Path to copy file to FileCopy($sPath1, $sNewPath)EndFunc<{POST_SNAPBACK}>you need to include date.au3In the help file for _DateDiff it reads.#include <Date.au3> ; This is what you are missing. Place this at the top of your script_DateDiff($sType, $sStartDate, $sEndDate)See include in the help file for more information on including files. Kerby Link to comment Share on other sites More sharing options...
ScriptMerchant Posted May 16, 2005 Author Share Posted May 16, 2005 you need to include date.au3In the help file for _DateDiff it reads.#include <Date.au3> ; This is what you are missing. Place this at the top of your script_DateDiff($sType, $sStartDate, $sEndDate)See include in the help file for more information on including files.<{POST_SNAPBACK}>I updated the script I dont get any error but when I run it I get a AutoIt icon in the corner that says "Script Paused" any idea what this means - theres nothing in the help file - I also tried searching the forum..?? Here is the updated script:#include <Date.au3>Main()Func Main() Local $sPath1 = "C:" Local $sPath2 = "24HourBackUp\" Local $search = FileFindFirstFile("C:\" & "*.doc") Local $FileDate = FileGetTime("C:\" & "*.doc") Local $GFile = "_DateTimeFormat(-1)" FileIterate($sPath1, "MyCopy") EndFunc; Main()Func FileIterate($sPath, $sCallback)$search = FileFindFirstFile("C:\" & "*.doc"); Check if the search was successfulIf $search = -1 Then FileCopy("NoMatchingFilesFound", "DynamicNoMatchingFilesFound.txt") ExitEndIfWhile 1 Local $sFile = FileFindNextFile($search)$sDate = @MON & "/" & @MDAY & "/" & @YEAR$sDate = $sDate -1 FileGetTime("*.doc")If _DateIsValid( $sDate) ThenFileCopy("C:\$sDate*.doc", "$sPath2") $file = FileFindNextFile($search)Call($sCallback, $sPath & "\" & $sFile) If @error Then ExitLoop EndIfWEnd EndFunc; FileIterate() Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now