Sign in to follow this  
Followers 0
buzz44

Check if Files copied

1 post in this topic

hello all, im currently working on a small program that will backup a folder to another location, it has a progress bar showing you the status etc, my problem is, to check if the files were copied successfully it would the the size of the original dirctory abd compare it to the copied on, if true then its all good, but ofcourse i didnt realise that if you already had file/folders in the folder you were copying the original to, there not going to = the same size, so what i need is a different method to check if the files are there, here it is

$search = FileFindFirstFile("*.*")  
$file1 = FileOpen("test.txt", 1)

While 1
$file = FileFindNextFile($search) 
If @error Then ExitLoop
FileWrite($file1, $file & @CRLF)

wend
FileClose($file)

i am using that code to put the list of folders/files in a text file., each line contains a file/folder so i can read it line by line, i then use this code to read it

$test = FileOpen("test.txt", 0)
$test1 = FileOpen("test1.txt", 0)

Do
$file1 = FileReadLine ($test)
$file2 = FileReadLine ($test1)
Until @error = -1

If $file1 = $file2 then
msgbox(0, "", "file are there") 
else
msgbox(0, "", "all files arent there")
EndIf

for easier testing i just made "test1.txt" myself and copied the contents of "test" to there. the above code....,i think, compares the 2 to check if the contents are the same, my problem is sometimes it works and sometimes it doesnt ie. if i had extra lines to "test1" which would be the copied folder, it still sez all the files are there, which is correct, but if i delete some of the files it still sez all files are there, even though they are not, i cant seem to find what makes it say it sumtimes and others not :D, what im now doing is make it search the second text file for all of the lines in the first one ie, if it doesnt find atleast one of the lines in the other text document, u get msg "not copied right" or sumthing, and if it find all the lines + other lines (which would be files/folders that are already in the directory b4 oyu copied it) it will tell you that all files are copied successfully,

what i need help for, is the coding to search the second text file for the lines which are contained in the first. thanks for reading :idiot:, and help much appreciated.


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

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