Jump to content

Recommended Posts

Posted

now im working on a project that could make rather large difference... this isnt the direct program but it does the components for it... so the problem is it always keeps replacing even if the size = size2

it shouldnt do that but it does!...

take a look

$search = FileFindFirstFile(@ScriptDir & "/dir1/*.*")  
$i = 0
FileDelete("files.tsf")
; Check if the search was successful
_main()
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
func _main()
while 1
    $file = FileFindNextFile($search) 
    $file_exist = FileExists(@ScriptDir & "/dir2/" & $file)
    $file_size = FileGetSize(@ScriptDir & "/dir1/" & $file) 
    $file_size2 = FileGetSize($file_exist) 
    if $file_size <> $file_size2 then FileWriteLine("files.tsf", $file & @CRLF)
    if $file_size <> $file_size2 then FileCopy(@ScriptDir & "/dir1/" & $file, @ScriptDir & "/patch/", 1)
    if $file_size <> $file_size2 then TrayTip("", "seems ok", 0)
        $i = $i +1
        if @error then exit
        wend
EndFunc
; Close the search handle

FileClose($search)
  • Developers
Posted

get size of the file in the other dir... this works like an updater.... only it takes all the files what are different between the two folders dir1 and dir2 and copy them to another folder....

Understood that but what do you think the content of the variable $file_exist is?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

now im working on a project that could make rather large difference... this isnt the direct program but it does the components for it... so the problem is it always keeps replacing even if the size = size2

it shouldnt do that but it does!...

take a look

$search = FileFindFirstFile(@ScriptDir & "/dir1/*.*")  
$i = 0
FileDelete("files.tsf")
; Check if the search was successful
_main()
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
func _main()
while 1
    $file = FileFindNextFile($search) 
    $file_exist = FileExists(@ScriptDir & "/dir2/" & $file)
    $file_size = FileGetSize(@ScriptDir & "/dir1/" & $file) 
    $file_size2 = FileGetSize($file_exist) 
    if $file_size <> $file_size2 then FileWriteLine("files.tsf", $file & @CRLF)
    if $file_size <> $file_size2 then FileCopy(@ScriptDir & "/dir1/" & $file, @ScriptDir & "/patch/", 1)
    if $file_size <> $file_size2 then TrayTip("", "seems ok", 0)
        $i = $i +1
        if @error then exit
        wend
EndFunc
; Close the search handle

FileClose($search)

$file_exist = FileExists(@ScriptDir & "/dir2/" & $file)

$file_size2 = FileGetSize($file_exist)

FileExists (from the help file)

Return Value

Success: Returns 1.

Failure: Returns 0 if path/file does not exist.

you are getting the file size of a 1 or 0 not the file you are looking for

Gnatwork Networks

Posted (edited)

ou crap.... THX u guys... :D u guys!

u were right!

correct is this...

$search = FileFindFirstFile(@ScriptDir & "/test/*.*")  
$i = 0
FileDelete("files.tsf")
; Check if the search was successful
_main()
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf
func _main()
while 1
    $file = FileFindNextFile($search) 
    $file_size = FileGetSize(@ScriptDir & "/test/" & $file) 
    $file_size2 = FileGetSize(@ScriptDir & "/patch/" & $file) 
    if $file_size <> $file_size2 then FileWriteLine("files.tsf", $file & @CRLF)
    if $file_size <> $file_size2 then FileCopy(@ScriptDir & "/test/" & $file, @ScriptDir & "/patch/", 1)
    if $file_size = $file_size2 then TrayTip("", "seems ok", 0)
        $i = $i +1
        wend
EndFunc
; Close the search handle
Func _map()

EndFunc
FileClose($search)
Edited by Zibit

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
×
×
  • Create New...