Necromorph Posted November 3, 2010 Share Posted November 3, 2010 (edited) any ideas why this doesn't work? #include<File.au3> $files = _FileListToArray(@MyDocumentsDir, "*.*", 1) For $x = 1 to $files $var = FileGetTime($files[$x], 0, 1) MsgBox(0, '', $var) Next i just get a blank msgbox, and not sure why. thanks for any help. Edited November 3, 2010 by redLabel Link to comment Share on other sites More sharing options...
iamtheky Posted November 3, 2010 Share Posted November 3, 2010 (edited) Bad FOR statement And filelisttoarray returns filenames, not full paths. #include<File.au3> $files = _FileListToArray(@MyDocumentsDir, "*.*", 1) For $x = 1 to ubound($files) - 1 $var = FileGetTime(@MyDocumentsDir & "\" & $files[$x], 0, 1) MsgBox(0, '', $var) Next Edit: put the msgbox in the loop so you can see all the timestamps Edited November 3, 2010 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 3, 2010 Moderators Share Posted November 3, 2010 redLabel, any ideas why this doesn't work?Several! - 1. You need to specify a value for the end of your loop. That means the [0] element of $files - not the array itself. - 2. _FileListToArray does not include the path in the return - so you have to add it yourself when you look for the file time. If you do that you should find it works: #include<File.au3> $files = _FileListToArray(@MyDocumentsDir, "*.*", 1) For $x = 1 to $files[0] ; <<<<<<<<<<<<<<<<<<< $var = FileGetTime(@MyDocumentsDir & "\" & $files[$x], 0, 1) ; <<<<<<<<<<<<<<<<<<< MsgBox(0, '', $var) Next M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Necromorph Posted November 3, 2010 Author Share Posted November 3, 2010 Thanks, your statement answered my question "And filelisttoarray returns filenames, not full paths." this was just an example of what im doing not exactly what is in my script, that is why i didn't have the & "\" after the @MyDocumentsDir, forgot. thanks for you help. Link to comment Share on other sites More sharing options...
Necromorph Posted November 3, 2010 Author Share Posted November 3, 2010 #include<File.au3> $archivesLocalDir = @MyDocumentsDir & "\folder\Outlook Archives\" $archivesNetworkDir = @HomeDrive & "\folder\Outlook Archives\" If @HomeDrive <> "U:" or DriveStatus("U:") <> "Ready" Then Exit Else _File_ModifiedCopy() EndIf Func _File_ModifiedCopy() $filesLocal = _FileListToArray($archivesLocalDir) For $x = 1 to UBound($filesLocal) - 1 If Not FileExists($archivesNetworkDir & $filesLocal[$x]) Then FileCopy($archivesLocalDir & $filesLocal[$x], $archivesNetworkDir) Else If FileGetTime($archivesLocalDir & $filesLocal[$x], 0, 1) > FileGetTime($archivesNetworkDir & $filesLocal[$x], 0, 1) Then FileCopy($archivesLocalDir & $filesLocal[$x], $archivesNetworkDir, 1) EndIf EndIf Next EndFunc this is what i have, and it works to some extent, but i know its going to copy the entire dir contents if a file is changed or file is added, so i need help to only copy files that have changed. like i said this is working, but i think i have made it way to complicated. please help. 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