Sign in to follow this  
Followers 0
iceberg

FileCopy New Files

6 posts in this topic

Hi,

Why doesn't this work? Pls help me.

AutoItSetOption("TrayIconHide", 1)
$t =  FileGetTime("D:\Test.txt", 0)
$s =  FileGetTime("C:\Test.txt", 0)

If $s > $t Then
    Filecopy("c:\test.txt", "d:\test.txt", 1)
EndIf

Thanks.


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites



because FileGetTime() returns an array, and you are not checking the array values

Try this to see the values

AutoItSetOption("TrayIconHide", 1)
$t =  FileGetTime("D:\Test.txt", 0)
$s =  FileGetTime("C:\Test.txt", 0)

If $s > $t Then
    Filecopy("c:\test.txt", "d:\test.txt", 1)
EndIf

For $x = 1 to $t[0]
    MsgBox(0,"test", $t[$x] & "  " & $s[$x] )
Next

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Hi,

thanks for highlighting. but i got an error

Line 10:

MsgBox(0,"test", $t[$x] & " " & $s[$x] )

MsgBox(0,"test", ^ERROR

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded.

Thanks.


mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites

$t =  FileGetTime("D:\Test.txt", 0)
$s =  FileGetTime("C:\Test.txt", 0)

If $s > $t Then
    Filecopy("c:\test.txt", "d:\test.txt", 1)
EndIf

For $x = 1 to 5
    MsgBox(0,"test", $t[$x] & "  " & $s[$x] )
Next
.

that will work...its the idea ... not the actual code above

have you tried

FileGetSize() ; no array needed

FileGetVersion ; no array needed

???

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

thanks Valuater,

the FileGetSize solved my problem!

Edited by iceberg

mouse not found....scroll any mouse to continue.

Share this post


Link to post
Share on other sites

Glad I could Help

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0