Sign in to follow this  
Followers 0
Pietka

Backup, Progress And File Changed Or Not ....

15 posts in this topic

Hi folks,

I admit - wroten few times - am alame in programming :) Need your help !

Have backup script written by Ezzetabi - really good but need changes to it:

;setting up variables- mydocs,username

$mydocs = @MyDocumentsDir

$desktop = @DesktopDir

$favorites = @FavoritesDir

$apps = @UserProfileDir

_CopyDirWithProgress($desktop, "z:\Desktop")

_CopyDirWithProgress2($mydocs, "z:\My Documents")

_CopyDirWithProgress3($favorites, "z:\Favorites")

_CopyDirWithProgress4($apps & "\Local Settings\Application Data\Microsoft\outlook", "z:\Outlook")

; First function makes a backup of Desktop files

Func _CopyDirWithProgress($sOriginalDir, $sDestDir)

;$sOriginalDir and $sDestDir are quite selfexplanatory...

;This func returns:

; -1 in case of critical error, bad original (@error = 1) or destination (@error = 2) dir

; '' (empty string) if everything went all right

;

; 'list|list|list' list of uncopied files, original full paths separed by pipes '|'

; @error is also set to 3

If StringRight($sOriginalDir, 1) <> '\' Then $sOriginalDir = $sOriginalDir & '\'

If StringRight($sDestDir, 1) <> '\' Then $sDestDir = $sDestDir & '\'

ProgressOn('Copying...', 'Making list of files...', '', -1, -1, 18)

Local $aFileList = _FileSearch($sOriginalDir)

If $aFileList[0] = 0 Then

ProgressOff()

SetError(1)

Return -1

EndIf

If FileExists($sDestDir) Then

If Not StringInStr(FileGetAttrib($sDestDir), 'd') Then

ProgressOff()

SetError(2)

Return -1

EndIf

Else

DirCreate($sDestDir)

If Not FileExists($sDestDir) Then

ProgressOff()

SetError(2)

Return -1

EndIf

EndIf

Local $iDirSize, $iCopiedSize = 0, $fProgress = 0

Local $c, $FileName, $iOutPut = ''

Local $Sl = StringLen($sOriginalDir)

_Quick_Sort($aFileList, 1, $aFileList[0])

$iDirSize = Int(DirGetSize ($sOriginalDir) / 1024)

ProgressSet(Int($fProgress * 100), $aFileList[$c], 'Copying Desktop files:')

For $c = 1 To $aFileList[0]

$FileName = StringTrimLeft($aFileList[$c], $Sl)

If StringInStr(FileGetAttrib($aFileList[$c]), 'd') Then

DirCreate($sDestDir & $FileName)

Else

ProgressSet(Int($fProgress * 100), $aFileList[$c] & @lf & 'Total Kbytes: ' & $iDirSize & @lf & 'Done Kbytes: ' & $iCopiedSize)

If Not FileCopy($aFileList[$c], $sDestDir & $FileName, 0) Then

$iOutPut = $iOutPut & '|' & $aFileList[$c]

EndIf

$iCopiedSize = $iCopiedSize + Int(FileGetSize($aFileList[$c]) / 1024)

$fProgress = $iCopiedSize / $iDirSize

EndIf

Next

ProgressOff()

If $iOutPut <> '' Then SetError(3)

Return $iOutPut

EndFunc ;==>_CopyDirWithProgress

And the question - how to rebuild script to:

1) preserve current functions

2) next time copy ONLY files which changed time ....

Second point is for me a black magic - please help !!!!

Regards

Pietka

Share this post


Link to post
Share on other sites



1) Not sure what you mean about preserve current functions

2) Look at FileGetTime() in the helpfile to get info abotu the file. You can use time created, modified or accessed using FileGetTime()


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

Hey - You are quick :D

Oki doki - wasn't clear enough ...

Preserve means - want to have progress bar, and information which file is currently copying , also info about size of copied files and size of files to copy.

About filegettime - well .. I know there is a function but have no clue how to rebuild current script to use filegettime ... :(

Please help :) Any suggestion is really appreciated !

Pietka

Share this post


Link to post
Share on other sites

Im workin on thsi now, any way you could send me _FileSearch(), i get an error when running the code you supplied, say s this function is missign, im guessing you jsut didnt paste it into your post.

thanks


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

Oki - here full code ( almost copy function is reapeated 5 times here U have only one time ):

; Script Start - Add your code below here

SplashImageOn ( "test", "w:\backup3\backup.gif",468,95,-1,-1,17)

sleep(1500)

splashoff()

;Asks user does he/she want to perform backup

$answer = msgbox (36,"test", "This Program will backup your personal data." & @CRLF & "PLEASE CLOSE ALL APPLICATIONS !" & @CRLF & "Would you like to continue?",20)

Select

case $answer = 7

MsgBox(0, "test", "OK, Bye!")

exit

case $answer= -1

exit

endselect

;Log

$logfile = FileOpen ("w:\IT\backup3\Logs\login.log" , 1)

FileWriteLine ($logfile,'Backup started ' & @username & ' logged on to ' & @computername&' at '& @MDAY & '.' & @MON & '.' & @YEAR & ' on ' & @HOUR & ':' & @MIN & ':' & @SEC)

FileClose ($logfile)

$begin = TimerStart()

HotKeySet("{ESC}", "Terminate")

HotKeySet("{F1}", "ShowMessage") ;F1

;Run batch file to map server drive, create main folder, creates backup folder and add rights to it. Also logs are created

RunWait(@ComSpec & " /c " & 'maprights.bat', "w:\it\backup3", @SW_HIDE)

;Closing application - Outlook - without deleting "deleted items" folder

ProcessClose("outlook.exe")

$PID = ProcessExists("outlook.exe") ; Will return the PID or 0 if the process isn't found.

If $PID Then ProcessClose($PID)

;setting up variables- mydocs,username

$mydocs = @MyDocumentsDir

$desktop = @DesktopDir

$favorites = @FavoritesDir

$apps = @UserProfileDir

_xcopyWithDialog($mydocs,"z:\" & @computername & "\My Documents" )

_xcopyWithDialog2($desktop, "z:\" & @computername & "\Desktop")

_xcopyWithDialog3($favorites, "z:\" & @computername & "\Favorites")

_xcopyWithDialog4($apps & "\Local Settings\Application Data\Microsoft\outlook\", "z:\" & @computername & "\Outlook")

Func _xcopyWithDialog($sStartingDir, $sDestDir, $sSettings = '/i/c/e/d/h/r/y')

Local $iPid, $iSDSize, $iODSize

If FileExists($sStartingDir) And StringInStr(FileGetAttrib($sStartingDir), 'd') Then

$iPid = Run(@comspec & ' /c xcopy "' & $sStartingDir & '" "' & $sDestDir & '" ' & $sSettings,'',@sw_hide)

$iSDSize = DirGetSize($sStartingDir)

ProgressOn ( "Backup 3.0", "Copying My Documents - please wait...","",700 ,600 )

While ProcessExists($iPid)

$iODSize = DirGetSize($sDestDir)

ProgressSet(Round(100 * $iODSize / $iSDSize) )

Sleep(100)

WEnd

ProgressOff( )

Else

Return -1

EndIf

EndFunc

;Here is five times repeated xcopy function for all folders

;funkcja zapisujaca czas jak dlugo dana operacja byla wykonywana

$dif = TimerStop($begin)

$timeres = $dif/1000

;Deleting map drive

RunWait(@ComSpec & " /c " & 'mapdel.bat', "w:\it\backup3", @SW_HIDE)

Select

case $timeres > 60

$minutes = int($timeres/60)

MsgBox(0,"Backup is F I N I S H E D !","Backup has been finished after " & $minutes &" minutes",3600)

exit

case $timeres < 60

$seconds = int($timeres)

MsgBox(0,"Backup is F I N I S H E D !","Backup has been finished after " & $seconds &" seconds",3600)

exit

endselect

This script works without any issues ... help please :)))))

Share this post


Link to post
Share on other sites

#include <Array.au3>

;setting up variables- mydocs,username
$mydocs = @MyDocumentsDir
$desktop = @DesktopDir
$favorites = @FavoritesDir
$apps = @UserProfileDir

_CopyDirWithProgress($desktop, "z:\Desktop")
_CopyDirWithProgress2($mydocs, "z:\My Documents")
_CopyDirWithProgress3($favorites, "z:\Favorites")
_CopyDirWithProgress4($apps & "\Local Settings\Application Data\Microsoft\outlook", "z:\Outlook")

; First function makes a backup of Desktop files
Func _CopyDirWithProgress($sOriginalDir, $sDestDir)
;$sOriginalDir and $sDestDir are quite selfexplanatory...
;This func returns:
; -1 in case of critical error, bad original (@error = 1) or destination (@error = 2) dir
; '' (empty string) if everything went all right
;
; 'list|list|list' list of uncopied files, original full paths separed by pipes '|'
; @error is also set to 3

    If StringRight($sOriginalDir, 1) <> '\' Then $sOriginalDir = $sOriginalDir & '\'
        If StringRight($sDestDir, 1) <> '\' Then $sDestDir = $sDestDir & '\'

            ProgressOn('Copying...', 'Making list of files...', '', -1, -1, 18)
            Local $aFileList = _FileSearch($sOriginalDir)
            If $aFileList[0] = 0 Then
                ProgressOff()
                SetError(1)
                Return -1
            EndIf   

            If FileExists($sDestDir) Then
                If Not StringInStr(FileGetAttrib($sDestDir), 'd') Then
                    ProgressOff()
                    SetError(2)
                    Return -1
                EndIf
            Else
                DirCreate($sDestDir)
                If Not FileExists($sDestDir) Then
                ProgressOff()
                SetError(2)
                Return -1
            EndIf
        EndIf

    Local $iDirSize, $iCopiedSize = 0, $fProgress = 0
    Local $c, $FileName, $iOutPut = ''
    Local $Sl = StringLen($sOriginalDir)

;**********************************************ADDED THIS*******************************************************************

;If we get to this point then the file list ahs been generated successfuly

;now check the current files against the existing files in the remote directory
Local rFileList = _FileSearch( $SDestDir );create a remote file list of all files in dest dir

;If the lsit is not empty then we must perform time checks, toherwise proceed without checking
If $rFileList[0] <> 0 Then
;We will now check to see if any file in the orig dir appears in the remote dir
;if the files do appear in both dir, check their times of modification, if times dont match, put them on copy list
;if they only appear in orig dir then put them on copy list
    _Quick_Sort($aFileList, 1, $aFileList[0])   
    _Quick_Sort($rFileList, 1, $rFIleList[0])

    For $iter = 1 To $aFileList[0]
        $key = _ArrayBinarySearch( $rFileList, $aFileList[ $iter ] )
        $oFile = StringTrimLeft($aFileList[$iter], $Sl)
        $dFile = StringTrimLeft($rFileList[$iter], StringLen($sDestDir) )
    ;if key is not an empty string then the file is in the dest dir, check time
        If $key <> "" Then
            If FileGetTime( $oFile, 0, 1 ) = FileGetTime( $dFile, 0, 1 ) Then
            ;if the file times are the smae on orig and dest dir of file occurence, dont copy this file
                _ArrayDelete( $aFileList, $iter )
                $aFileList[0] = $aFileList[0] - 1
            EndIf
        EndIf
    Next

;at this point aFileList should contain only the files to copy, not the unmodified ones
EndIf
;**********************************************END ADDITION*******************************************************************

    $iDirSize = Int(DirGetSize ($sOriginalDir) / 1024)

    ProgressSet(Int($fProgress * 100), $aFileList[$c], 'Copying Desktop files:')
    For $c = 1 To $aFileList[0]
        $FileName = StringTrimLeft($aFileList[$c], $Sl)
        If StringInStr(FileGetAttrib($aFileList[$c]), 'd') Then
            DirCreate($sDestDir & $FileName)
        Else
            ProgressSet(Int($fProgress * 100), $aFileList[$c] & @lf & 'Total Kbytes: ' & $iDirSize & @lf & 'Done Kbytes: ' & $iCopiedSize)
            If Not FileCopy($aFileList[$c], $sDestDir & $FileName, 0) Then
                $iOutPut = $iOutPut & '|' & $aFileList[$c]
            EndIf
            $iCopiedSize = $iCopiedSize + Int(FileGetSize($aFileList[$c]) / 1024)
            $fProgress = $iCopiedSize / $iDirSize
        EndIf
    Next

    ProgressOff()
    
    If $iOutPut <> '' Then SetError(3)
    
    Return $iOutPut

EndFunc;==>_CopyDirWithProgress

Based off of the first post, thsi code should work, what i added was a loop that check all files in original dir against those int he dest dir, if a file in the original dir was found in the dest dir then the time of modifications were compared and if they are the same the file is removed from the list of files to be copied.


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

Hey,

thanks for your support and effort - You are good !

But I still have the problem. Error message appears :

Line 142 : LocalrFileList=_FileSearch($DestDir); Create a remote file of list of all files in dest dir

Local ^ ERROR

:((

Let me paste my whole (long ) script - If U are able to find the reason - whould be great !!!

SplashImageOn ( "Test", "w:\IT\backup2\backup.gif",468,95,-1,-1,17)

sleep(3000)

splashoff()

;Asks user does he/she want to perform backup

$answer = msgbox (36,"Backup", "This Program will backup your personal data." & @CRLF & "PLEASE CLOSE ALL APPLICATIONS !" & @CRLF & "Would you like to continue?",20)

Select

case $answer = 7

MsgBox(0, "Backup", "OK, Bye!")

exit

case $answer= -1

exit

endselect

;Log creating

$logfile = FileOpen ("w:\IT\backup\Logs\login.log" , 1)

FileWriteLine ($logfile,'Backup started ' & @username & ' logged on to ' & @computername&' at '& @MDAY & '.' & @MON & '.' & @YEAR & ' on ' & @HOUR & ':' & @MIN & ':' & @SEC)

FileClose ($logfile)

$begin = TimerStart()

HotKeySet("{ESC}", "Terminate")

HotKeySet("{F1}", "ShowMessage") ;F1

;Run batch file to map server drive and add rights to it. Also logs are created

RunWait(@ComSpec & " /c " & 'maprights.bat', "w:\it\backup2", @SW_HIDE)

;setting up variables- mydocs,username

$mydocs = @MyDocumentsDir

$desktop = @DesktopDir

$favorites = @FavoritesDir

$apps = @UserProfileDir

;

;**********Program should copy files to mapped Z; drive - changed to C: drive error same error appears

_CopyDirWithProgress($desktop, "z:\Desktop")

;_CopyDirWithProgress2($mydocs, "z:\My Documents")

;_CopyDirWithProgress3($favorites, "z:\Favorites")

;_CopyDirWithProgress4($apps & "\Local Settings\Application Data\Microsoft\outlook", "z:\Outlook")

;_CopyDirWithProgress5("c:\Program files\rdt", "z:\RDT")

;Final log

$logfile = FileOpen ("w:\IT\backup\Logs\login.log" , 1)

FileWriteLine ($logfile,'Backup finished ' & @username & ' logged on to ' & @computername&' at '& @MDAY & '.' & @MON & '.' & @YEAR & ' on ' & @HOUR & ':' & @MIN & ':' & @SEC)

FileClose ($logfile)

; First function makes a backup of Desktop files

Func _CopyDirWithProgress($sOriginalDir, $sDestDir)

;$sOriginalDir and $sDestDir are quite selfexplanatory...

;This func returns:

; -1 in case of critical error, bad original (@error = 1) or destination (@error = 2) dir

; '' (empty string) if everything went all right

;

; 'list|list|list' list of uncopied files, original full paths separed by pipes '|'

; @error is also set to 3

If StringRight($sOriginalDir, 1) <> '\' Then $sOriginalDir = $sOriginalDir & '\'

If StringRight($sDestDir, 1) <> '\' Then $sDestDir = $sDestDir & '\'

ProgressOn('Copying...', 'Making list of files...', '', -1, -1, 18)

Local $aFileList = _FileSearch($sOriginalDir)

If $aFileList[0] = 0 Then

ProgressOff()

SetError(1)

Return -1

EndIf

If FileExists($sDestDir) Then

If Not StringInStr(FileGetAttrib($sDestDir), 'd') Then

ProgressOff()

SetError(2)

Return -1

EndIf

Else

DirCreate($sDestDir)

If Not FileExists($sDestDir) Then

ProgressOff()

SetError(2)

Return -1

EndIf

EndIf

Local $iDirSize, $iCopiedSize = 0, $fProgress = 0

Local $c, $FileName, $iOutPut = ''

Local $Sl = StringLen($sOriginalDir)

;**********************************************ADDED THIS*******************************************************************

;If we get to this point then the file list ahs been generated successfuly

;now check the current files against the existing files in the remote directory

Local rFileList = _FileSearch( $SDestDir );create a remote file list of all files in dest dir

;If the lsit is not empty then we must perform time checks, toherwise proceed without checking

If $rFileList[0] <> 0 Then

;We will now check to see if any file in the orig dir appears in the remote dir

;if the files do appear in both dir, check their times of modification, if times dont match, put them on copy list

;if they only appear in orig dir then put them on copy list

_Quick_Sort($aFileList, 1, $aFileList[0])

_Quick_Sort($rFileList, 1, $rFIleList[0])

For $iter = 1 To $aFileList[0]

$key = _ArrayBinarySearch( $rFileList, $aFileList[ $iter ] )

$oFile = StringTrimLeft($aFileList[$iter], $Sl)

$dFile = StringTrimLeft($rFileList[$iter], StringLen($sDestDir) )

;if key is not an empty string then the file is in the dest dir, check time

If $key <> "" Then

If FileGetTime( $oFile, 0, 1 ) = FileGetTime( $dFile, 0, 1 ) Then

;if the file times are the smae on orig and dest dir of file occurence, dont copy this file

_ArrayDelete( $aFileList, $iter )

$aFileList[0] = $aFileList[0] - 1

EndIf

EndIf

Next

;at this point aFileList should contain only the files to copy, not the unmodified ones

EndIf

;**********************************************END ADDITION*******************************************************************

$iDirSize = Int(DirGetSize ($sOriginalDir) / 1024)

ProgressSet(Int($fProgress * 100), $aFileList[$c], 'Copying Desktop files:')

For $c = 1 To $aFileList[0]

$FileName = StringTrimLeft($aFileList[$c], $Sl)

If StringInStr(FileGetAttrib($aFileList[$c]), 'd') Then

DirCreate($sDestDir & $FileName)

Else

ProgressSet(Int($fProgress * 100), $aFileList[$c] & @lf & 'Total Kbytes: ' & $iDirSize & @lf & 'Done Kbytes: ' & $iCopiedSize)

If Not FileCopy($aFileList[$c], $sDestDir & $FileName, 0) Then

$iOutPut = $iOutPut & '|' & $aFileList[$c]

EndIf

$iCopiedSize = $iCopiedSize + Int(FileGetSize($aFileList[$c]) / 1024)

$fProgress = $iCopiedSize / $iDirSize

EndIf

Next

ProgressOff()

If $iOutPut <> '' Then SetError(3)

Return $iOutPut

EndFunc ;==>_CopyDirWithProgress

Func _FileSearch($sIstr, $bSF = 1)

; $bSF = 1 means looking in subfolders

; $sSF = 0 means looking only in the current folder.

; An array is returned with the full path of all files found. The pos [0] keeps the number of elements.

Local $sIstr, $bSF, $sCriteria, $sBuffer, $iH, $iH2, $sCS, $sCF, $sCF2, $sCP, $sFP, $sOutPut = '', $aNull[1]

$sCP = StringLeft($sIstr, StringInStr($sIstr, '\', 0, -1))

If $sCP = '' Then $sCP = @WorkingDir & '\'

$sCriteria = StringTrimLeft($sIstr, StringInStr($sIstr, '\', 0, -1))

If $sCriteria = '' Then $sCriteria = '*.*'

;To begin we seek in the starting path.

$sCS = FileFindFirstFile($sCP & $sCriteria)

While $sCS <> - 1

$sCF = FileFindNextFile($sCS)

If @error Then

FileClose($sCS)

ExitLoop

EndIf

If $sCF = '.' Or $sCF = '..' Then ContinueLoop

$sOutPut = $sOutPut & $sCP & $sCF & @LF

Wend

;And after, if needed, in the rest of the folders.

If $bSF = 1 Then

$sBuffer = @CR & $sCP & '*' & @LF;The buffer is set for keeping the given path plus a *.

Do

$sCS = StringTrimLeft(StringLeft($sBuffer, StringInStr($sBuffer, @LF, 0, 1) - 1), 1);current search.

$sCP = StringLeft($sCS, StringInStr($sCS, '\', 0, -1));Current search path.

$iH = FileFindFirstFile($sCS)

While $iH <> - 1

$sCF = FileFindNextFile($iH)

If @error Then

FileClose($iH)

ExitLoop

EndIf

If $sCF = '.' Or $sCF = '..' Then ContinueLoop

If StringInStr(FileGetAttrib($sCP & $sCF), 'd') Then

$sBuffer = @CR & $sCP & $sCF & '\*' & @LF & $sBuffer;Every folder found is added in the begin of buffer

$sFP = $sCP & $sCF & '\'; for future searches

$iH2 = FileFindFirstFile($sFP & $sCriteria); and checked with the criteria.

While $iH2 <> - 1

$sCF2 = FileFindNextFile($iH2)

If @error Then

FileClose($iH2)

ExitLoop

EndIf

If $sCF2 = '.' Or $sCF2 = '..' Then ContinueLoop

$sOutPut = $sOutPut & $sFP & $sCF2 & @LF;Found items are put in the Output.

Wend

EndIf

Wend

$sBuffer = StringReplace($sBuffer, @CR & $sCS & @LF, '')

Until $sBuffer = ''

EndIf

If $sOutPut = '' Then

$aNull[0] = 0

Return $aNull

Else

Return StringSplit(StringTrimRight($sOutPut, 1), @LF)

EndIf

EndFunc ;==>_FileSearch

Func _Quick_Sort(ByRef $SortArray, $First, $Last);Larry code

Dim $Low, $High

Dim $Temp, $List_Separator

$Low = $First

$High = $Last

$List_Separator = StringLen($SortArray[ ($First + $Last) / 2])

Do

While (StringLen($SortArray[$Low]) < $List_Separator)

$Low = $Low + 1

Wend

While (StringLen($SortArray[$High]) > $List_Separator)

$High = $High - 1

Wend

If ($Low <= $High) Then

$Temp = $SortArray[$Low]

$SortArray[$Low] = $SortArray[$High]

$SortArray[$High] = $Temp

$Low = $Low + 1

$High = $High - 1

EndIf

Until $Low > $High

If ($First < $High) Then _Quick_Sort($SortArray, $First, $High)

If ($Low < $Last) Then _Quick_Sort($SortArray, $Low, $Last)

EndFunc ;==>_Quick_Sort

Please heeelp :) I'm stupid now :D

Regards

Pietka

Share this post


Link to post
Share on other sites

Oki doki my mistake - $ sign missing :| - will test the script further !

Share this post


Link to post
Share on other sites

Bad luck - it doesnt copy modified files :) Don N Please help once more !

Share this post


Link to post
Share on other sites

Does anything copy?...any errors generated?...does it work for the first time then not work after that for modified files? Ill try to fix it I jsut need a little more infor on how its not working


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

Change my section of the code( the code within the ******* blocks to the following )

;**********************************************ADDED THIS*******************************************************************

;If we get to this point then the file list ahs been generated successfuly

;now check the current files against the existing files in the remote directory
Local rFileList = _FileSearch( $SDestDir );create a remote file list of all files in dest dir

;If the lsit is not empty then we must perform time checks, toherwise proceed without checking
If $rFileList[0] <> 0 Then
;We will now check to see if any file in the orig dir appears in the remote dir
;if the files do appear in both dir, check their times of modification, if times dont match, put them on copy list
;if they only appear in orig dir then put them on copy list
    _Quick_Sort($aFileList, 1, $aFileList[0])   
    _Quick_Sort($rFileList, 1, $rFIleList[0])

    For $iter = 1 To $aFileList[0]
        $key = _ArrayBinarySearch( $rFileList, $aFileList[ $iter ] )
        $oFile = StringTrimLeft($aFileList[$iter], $Sl)
        For $iter2 = 1 To $rFileList[0]
            $dFile = StringTrimLeft($rFileList[$iter2], StringLen($sDestDir) )
        ;if key is not an empty string then the file is in the dest dir, check time
            If $key <> "" Then
                If FileGetTime( $oFile, 0, 1 ) = FileGetTime( $dFile, 0, 1 ) Then
                ;if the file times are the smae on orig and dest dir of file occurence, dont copy this file
                    _ArrayDelete( $aFileList, $iter )
                    $aFileList[0] = $aFileList[0] - 1
                EndIf
            EndIf
        Next    
    Next

;at this point aFileList should contain only the files to copy, not the unmodified ones
EndIf
;**********************************************END ADDITION*******************************************************************

I forgot a nested for loop, now it check every file in the origianl directory against eveyrfile in the dest directory. Before it jsut checked one array against the other :) .Should work now.


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

Hi Don N

Once more thanks for effort - but it still doesn't copy modfied files ...

If You have time and are still patient on this project - please take a look once more.

I did few tests and files changed in source are not copied to dest.

Share this post


Link to post
Share on other sites

:) This i foudn the problem. It is in this line

If Not FileCopy($aFileList[$c], $sDestDir & $FileName, 0) Then

The problem is the 0 argument is being passed to FileCopy, this means do NOT overwrite existing files with that name, change the 0 to a 1 and everythign should work perfect. Good luck, lemme knwo how it goes. If u need more with file copy it is listed in the Helpfile


_____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper

Share this post


Link to post
Share on other sites

Hi DON N :)

I 'm boring You probably - but still it has some problems - now it copies ALL files without verificatrion it has changed or not :D

Please begging ... help :(

Share this post


Link to post
Share on other sites

Don N is not responding - anybody can help me with that script ?

Regards

Pietka

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