DarkNecromancer Posted January 4, 2005 Share Posted January 4, 2005 i'm creating a program that will be able to check the date modified between my home school and the drive itself. Any variances will copy the file to the drive easy enough. But i've been stuck for a while with a problem. Whenever i check the attributes of the files to check for directories the results are always blank. i added the bit in th example to check for errors If @error Then MsgBox(4096,"Error", "Could not obtain attributes.") Exit Else If StringInStr($attrib, "R") Then MsgBox(4096,"", "File is read-only.") EndIf EndIf but it returns no errors. So i displayed the attributes and neither file nor directory return any attributes. This is off the removable drive that its reading. I was wondering if anyone had any ideas ~Dark Link to comment Share on other sites More sharing options...
CyberSlug Posted January 4, 2005 Share Posted January 4, 2005 Try the following--changing G:\filename.txt to something appropriate, of course, and report the results: $file = "G:\filename.txt" If Not FileExists($file) Then MsgBox(4096,"Error","File does not exist!") $attrib = FileGetAttrib($file) MsgBox(4096, "Err: " & @error, "Attributes:" & $attrib) The above seems to work for me with latest beta of AutoIt on WinXP Pro SP2 with a USB Flash Drive. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
DarkNecromancer Posted January 4, 2005 Author Share Posted January 4, 2005 (edited) ok i ran that and the directories returned d and all the other files returned a. So i dont know whats wrong with my code so i'll include the first part. I'll only post this for now because it isn't even getting past this.$search = FileFindFirstFile($drives[$i] & "\School\*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $fileattrib = FileGetAttrib ( $file ) msgbox(0, $file, $fileattrib) If @error Then MsgBox(4096,"Error", "Could not obtain attributes.") Exit Else If StringInStr($fileattrib, "R") Then MsgBox(4096,"", "File is read-only.") EndIf EndIf $attrib = StringInStr ( $fileattrib, "D" , 0 ) If $attrib <> 0 Then $d = $d + 1 $dirarray[$d] = $file else $y = $y + 1 $filearray[$y] = $file EndIf WEnd kinda an odd fact. When i have it tell me the attribute it finds, for . and .. it returnes D . why those 2 and not any of the others. Edited January 4, 2005 by DarkNecromancer Link to comment Share on other sites More sharing options...
CyberSlug Posted January 4, 2005 Share Posted January 4, 2005 (edited) Upon brief inspection, I believe FileFindNextFile only returns the file name without the full path!Try $fileattrib = FileGetAttrib ( $drives[$i] & "\School\" & $file ) to see if that helps. I'd verify that the output of FileFindNextFile is what you expect it to be, because FileGetAttrib only works with correct file names Edited January 4, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
DarkNecromancer Posted January 4, 2005 Author Share Posted January 4, 2005 (edited) ahhh that did the trick thanks a bunch CyberSlug ~Dark Edited January 4, 2005 by DarkNecromancer 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