Sign in to follow this  
Followers 0
Zibit

K I REALLY NEED HELP!

7 posts in this topic

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)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I really really need you to STOP typing capitals only in the thread title as that is VERY annoying.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#7 ·  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

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