Jump to content

A slight question...


Zibit
 Share

Recommended Posts

k... i know im asking too much but how difficult is an updater...

i want my program to compare 2 folders (with subfolders) and if few files in folder 1 doesnt match with folder 2, it copy's them into an new folder called patch... i'm working on a project... the folder has over 10000 files and over 50 subfolder's...

Edited by Zibit
Link to comment
Share on other sites

k... i know im asking too much but how difficult is an updater...

i want my program to compare 2 folders (with subfolders) and if few files in folder 1 doesnt match with folder 2, it copy's them into an new folder called patch... i'm working on a project... the folder has over 10000 files and over 50 subfolder's...

But, where is the question?

Is it that part about updater?

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

how can i make a program what copies all the files what dont match between folder 1 and folder 2 to another folder... sofar i figured out this:

$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)

the problem is the folders has over 50 subfolders

Edited by Zibit
Link to comment
Share on other sites

I cannot help you with any code, as I have not done this sort of thing before, but I can point you toward what I believe is the UDF you ought to be familiarizing yourself with, in order to better achieve your goal.

_FileListToArray()

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

k did well so long... but still something here... size's are coming in as 0

#Include <File.au3>
#Include <Array.au3>
$i = 0 ;Folder being examined
$FileListFolder = _FileListToArray(@ScriptDir & "/serv/", "*", 2) ;List Of Folders
$FileListFile = _FileListToArray(@ScriptDir & "/serv/", "*", 1) ;list of files in the folder
$dir = $FileListFolder[$i] ;chooses dir ( made for altering value 1 to list )
$search = FileFindFirstFile(@ScriptDir & $dir & "/*.*")  ;<---- u know what that is
$main = $FileListFolder[0] ;for until

FileDelete("files.tsf")
_main()
func _main()
do
    $file = FileFindNextFile($search) ;searches files
    $file_size2 = FileGetSize(@ScriptDir & $FileListFile[$i] & $file) ;size of file 2
    $file_size = FileGetSize(@ScriptDir & "/dir1/" & $file) ;size of file 1
    if $file_size <> $file_size2 then FileWriteLine("files.tsf", $file & @CRLF)
    if $file_size <> $file_size2 then FileCopy(@ScriptDir & $dir & $file, @ScriptDir & "/patch/", 1)
    if $file_size <> $file_size2 then TrayTip("", "seems ok", 0)
        MsgBox(0, "", $file_size, 0)
        MsgBox(0, "", $file_size2, 0)
        $i = $i + 1
        until $i = $main
EndFunc
FileClose($search)
Link to comment
Share on other sites

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

  • Developers

You need to do some debugging in stead of asking here to have things figured out for you.

Use Ctrl+D on variables in SciTE and a automatic consolewrite is generate and then run your script.

You will find something is missing in those values and it probably is missing some character somewhere. :mellow:

Jos

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.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...