skysel Posted March 4, 2011 Share Posted March 4, 2011 (edited) I've put some code together for copying / moving some server logs. I've added the FileCopy part, FileMove part worked before without problems. Now it appears it is not working - any advice would be helpful: #include <Date.au3> #include <File.au3> $srcfolder = "C:\WINDOWS\system32\LogFiles\W3SVC1" ; Set the source folder $FileList = _FileListToArray($srcfolder) ; List all files in the array $arTime = StringSplit(_DateAdd("D", -1, _NowCalcDate()), "/") ; Split yesterdays date up by the / delimeter Dim $newTime For $a = 1 To UBound($arTime) - 1 $newTime &= $arTime[$a] ; Everytime we find a piece of the date, concatenate it Next For $i = 1 To UBound($FileList) - 1 ; For each file in the array $FileTime = StringTrimRight(FileGetTime($srcfolder & "\" & $FileList[$i], 0, 1), 6) ; Get its creation date as a string and trim the time off If $FileTime <= $newTime Then ; If the file date matches the current date FileCopy($srcfolder & "\" & $FileList[$i], "\\msmq.domain.local\IISLogs\WEB01", 1) ; Copy the file to MSMQ FileMove($srcfolder & "\" & $FileList[$i], "\\fileshare.domain.local\TraceLogs\WEB-01-W3SVC", 1) ; Move the file EndIf Next Edited March 4, 2011 by skysel Link to comment Share on other sites More sharing options...
skysel Posted March 4, 2011 Author Share Posted March 4, 2011 I've put some code together for copying / moving some server logs. I've added the FileCopy part, FileMove part worked before without problems. Now it appears it is not working - any advice would be helpful: #include <Date.au3> #include <File.au3> $srcfolder = "C:\WINDOWS\system32\LogFiles\W3SVC1" ; Set the source folder $FileList = _FileListToArray($srcfolder) ; List all files in the array $arTime = StringSplit(_DateAdd("D", -1, _NowCalcDate()), "/") ; Split yesterdays date up by the / delimeter Dim $newTime For $a = 1 To UBound($arTime) - 1 $newTime &= $arTime[$a] ; Everytime we find a piece of the date, concatenate it Next For $i = 1 To UBound($FileList) - 1 ; For each file in the array $FileTime = StringTrimRight(FileGetTime($srcfolder & "\" & $FileList[$i], 0, 1), 6) ; Get its creation date as a string and trim the time off If $FileTime <= $newTime Then ; If the file date matches the current date FileCopy($srcfolder & "\" & $FileList[$i], "\\msmq.domain.local\IISLogs\WEB01", 1) ; Copy the file to MSMQ FileMove($srcfolder & "\" & $FileList[$i], "\\fileshare.domain.local\TraceLogs\WEB-01-W3SVC", 1) ; Move the file EndIf Next anyone? Link to comment Share on other sites More sharing options...
hannes08 Posted March 4, 2011 Share Posted March 4, 2011 Hello skysel, please wait 24hours before bumbing your topic. Maybe you want to try and check if the dest. file is already there and writeable before you do a FileMove. Use FileExists and FileOpen for example. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] 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