skysel 1 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 Share this post Link to post Share on other sites
skysel 1 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? Share this post Link to post Share on other sites
hannes08 39 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] Share this post Link to post Share on other sites