Jump to content

Anyone created a programmable sync/delete tool?


storme
 Share

Recommended Posts

G'day all

I've been doing a few rebuilds/transfers to new systems.

My usual is to copy their whole OLD C drive to the new computer (e.g. C:OLD_computer) AND use another tool that cherry picks the users data to be integrated into the new user on the new/rebuilt system.

I copy the WHOLE C drive because in the past I've run into the fact that programs/users spread their data data all over the place and I don't want to loose their data.

OK so now I have a directory with the WHOLE OLD C drive, a Copy of the userdata and the new system with all the userdata in place.  Customers happy and they go away... Until in the future they run out of hard drive because they forgot I said to delete the "Old Computer" folder when they were sure they had everything....sigh

So what I want to do is to compare the new C drives contents (minus the "OLD_computer" folder) with the "OLD_computer" and delete any exact duplicates from the "OLD_computer" folder.

I've found a few tools that do something like that but they are manual and a pain.

I know it's relatively easy in AutoIt....

{Outer directory traverser pointed at the C drive} (that doesn't traverse the "OLD_computer" folder.)

   Compare the current path with OLD_computerCurrent path

      If the file is the same delete it :)

However, I know that it won't be that easy and if someone has already done it I'll be saving myself a lot of work. :)

So anyone already done this and willing to share they code/approach/???

Thanks

John Morrison

Edit :  Add some highlighting yo clarify what I'm trying to do.

Edited by storme
Link to comment
Share on other sites

FreeFileSync

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Hey storme,

Your idea would require a lot of hard drive disk scanning, thus reducing the performance of the computer it's running on.

If you do this, your customers could say to you "doh my computer is so slow!" :)

You could do a small software that checks free space on hard drive of your customer every 2 mins. If it finds out that there is few free space, it could display a message like "Hey bro, seems like your hard drive is almost full! Remember to delete old computer folder if you don't need it anymore :)"

Link to comment
Share on other sites

Hey storme,

Your idea would require a lot of hard drive disk scanning, thus reducing the performance of the computer it's running on.

If you do this, your customers could say to you "doh my computer is so slow!" :)

You could do a small software that checks free space on hard drive of your customer every 2 mins. If it finds out that there is few free space, it could display a message like "Hey bro, seems like your hard drive is almost full! Remember to delete old computer folder if you don't need it anymore :)"

No you misunderstand I this would be done BEFORE it's given back to them so that the "wasted space" is minimal.

I can't think of any reason I'd leave a program like I described running on a computer as everything would be clean after the first run.

Thanks anyway for the feedback

John

Link to comment
Share on other sites

FreeFileSync

Hi guinness

I can't see how FreeFileSync would help me in this one.

I want to "delete" the files that are the same not copy them....

I use FreeFileSync to keep my various USB keys synced with the master copy on the server.  It's a great program.

Thanks for the feedback!

John Morrison

Link to comment
Share on other sites

John,

I don't understand why there should be any file of the old computer on the new computer if the new computer has been formated and only has a fresh windows install? :)

Link to comment
Share on other sites

John,

I don't understand why there should be any file of the old computer on the new computer if the new computer has been formated and only has a fresh windows install? :)

Because I've copied the OLD C DRIVE to the new C DRIVE (Usually under C:OLD Computer).....

My customers wouldn't be happy if I rebuilt their computers without saving their data (docs/photos/etc).....

Link to comment
Share on other sites

I have often your exact problem, but i have to transfer user data from corporate notebooks, so I have tell to my users that everything outside c:usersusername will be wiped.

This is the theory, users keep put every sort of thing in every place , like c:personalxxx :rolleyes:  , but if I forget that folder no one blame me.

I have developed a couple of programs  to do that in autoit (only for c:users and corporate programs), but for your particolar problem I think you can use .

It's a  script by user llewxam I have modified some time ago, perhaps in mirror mode, give a look to the screenshot. 

It has also command line mode, I use it in some servers over freefilesync, I don't remember why....

Bye

Edited by t0nZ
Link to comment
Share on other sites

So basicly you want to check for duplicates inside the old computer folder?

YEP!

However I don't want to Sync the duplicates I want to DELETE them on ONE side only.

 

As I stated in my pseudo code in the OP

 

I know it's relatively easy in AutoIt....

{Outer directory traverser pointed at the C drive} (that doesn't traverse the "OLD_computer" folder.)

   Compare the current path with OLD_computerCurrent path

      If the file is the same delete it :)

 

However, I know that it won't be that easy and if someone has already done it I'll be saving myself a lot of work. :)

I'd also prefer if it could "just do it" :)

(e.g. SomeProgramToDoThis C: C:OLD_computer /DeleteDups)

I found a program called ALLDup that will be a big help but is more a general purpose duplicate finder and can't be automated to do what I want it to do.

But it's in the toolbox for future duplicate clean up needs. :)

John Morrison

 

Link to comment
Share on other sites

I have often your exact problem, but i have to transfer user data from corporate notebooks, so I have tell to my users that everything outside c:usersusername will be wiped.

This is the theory, users keep put every sort of thing in every place , like c:personalxxx :rolleyes:  , but if I forget that folder no one blame me.

I have developed a couple of programs  to do that in autoit (only for c:users and corporate programs), but for your particolar problem I think you can use .

It's a  script by user llewxam I have modified some time ago, perhaps in mirror mode, give a look to the screenshot. 

It has also command line mode, I use it in some servers over freefilesync, I don't remember why....

Bye

Thanks

I did have his script in the back of my mind and did use it a while back until I had a few problems and moved to other programs.

I may revisit it again.

Thanks for the suggestion and you fork!

John Morrison

Link to comment
Share on other sites

      If the file is the same delete it :)

 

Are you wanting the EXACT file (MD2|MD4|MD5|SHA1|SHA256|SHA384|SHA512) match or just file name (FileExists)?

>Here I helped with if an older file exits it will replace the new with the old and could be converted either way with a little work.  Example would be to do a file list to array excluding C:OLD_Computer directory to compare with C:OLD_Computer.

Dealing with customers and their data myself, I would stick with t0nZ and say that you would back-up only "C:Users" folders and anything outside of that would not be saved unless explicitly asked for.  Also make sure to cover yourself with a signed document that you are not responsible for any data outside the scope of "C:Users" directory due to personal security measures.  If it is just a transfer from 1 HDD to another make sure to tell them to keep the OLD HDD in case they come across a file they remembered they needed.

Link to comment
Share on other sites

Would this still work with a Windows XP Old box going onto a Windows 7 New Box for the data

Because i would be interested in a solution if one exists, because the damn customers never save their data in the right places..

I use a robocopy backup written in cmd atm as it works everytime and doesnt fail.

But would automating Robocopy work for you because im sure there are some switches in it to not overwrite etc like

/MOVE or maybe /XO /XN

http://ss64.com/nt/robocopy.html

The _CopyRobo in my sig may help for testing

Edited by Chimaera
Link to comment
Share on other sites

>Synchronization - There is a search for "the same path and size". The checksum is not checked.
>Check_md5 - You can get the list. Then replace the path to another directory. And scan again. The output will be 2 files, match and mismatch. At least just write a script that deletes files.

 

>Create list of files - get a list of files (relative path) and checksum. >Compare strings - to compare two lists. Again, you only get a list of the identical.

Edited by AZJIO
Link to comment
Share on other sites

  • 1 month later...

Func _copie_compare($chemin_source, $chemin_destination)

    $source = _FileListToArrayRec($chemin_source, "*", 0, 1)

    $destination = _FileListToArrayRec($chemin_destination, "*", 0, 1)

    If FileExists($path & "flag.tmp") = 1 Then

        $log_copie = $path & "\log\source.log"

    Else

        $log_copie = $path & "\log\" & $sn & ".log"

    EndIf

    FileOpen($log_copie, 1)

;~     1 - On recopie ce qui est sur la source et qui n'est pas sur la cible

    For $i = 1 To UBound($source) - 1

        $recherche_copie = _ArraySearch($destination, $source[$i])

        If $recherche_copie = -1 Then

            If FileGetAttrib($chemin_source & "\" & $source[$i]) <> "D" Then

                FileCopy($chemin_source & "\" & $source[$i] & "\", $chemin_destination & "\" & $source[$i], $FC_CREATEPATH)

                FileSetTime($chemin_destination & "\" & $source[$i], FileGetTime($chemin_source & "\" & $source[$i], 0, 1), 0)

            Else

                DirCreate($chemin_destination & "\" & $source[$i] & "\")

            EndIf

            FileOpen($log_copie, 1)

            FileWrite($log_copie, @MDAY & "/" & @MON & "-" & @HOUR & ":" & @MIN & " * " & "Ajout " & $chemin_destination & "\" & $source[$i] & " - création" & @CRLF)

            FileClose($log_copie)

            ConsoleWrite("Ajout " & $chemin_destination & "\" & $source[$i] & " - création" & @CR)

        ElseIf FileGetTime($chemin_destination & "\" & $destination[$recherche_copie], 0, 1) <> FileGetTime($chemin_source & "\" & $source[$i], 0, 1) Then

            If FileGetAttrib($chemin_source & "\" & $source[$i]) <> "D" Then

                FileDelete($chemin_destination & "\" & $source[$i])

                FileCopy($chemin_source & "\" & $source[$i] & "\", $chemin_destination & "\" & $source[$i])

                FileSetTime($chemin_destination & "\" & $source[$i], FileGetTime($chemin_source & "\" & $source[$i], 0, 1), 0)

                FileOpen($log_copie, 1)

                FileWrite($log_copie, @MDAY & "/" & @MON & "-" & @HOUR & ":" & @MIN & " * " & "Rempl. " & $chemin_destination & "\" & $source[$i] & " - timestamp" & @CRLF)

                FileClose($log_copie)

                ConsoleWrite("Rempl. " & $chemin_destination & "\" & $source[$i] & " - timestamp" & @CR)

            EndIf

        ElseIf FileGetSize($chemin_destination & "\" & $destination[$recherche_copie]) <> FileGetSize($chemin_source & "\" & $source[$i]) Then

            If FileGetAttrib($chemin_source & "\" & $source[$i]) <> "D" Then

                FileDelete($chemin_destination & "\" & $source[$i])

                FileCopy($chemin_source & "\" & $source[$i] & "\", $chemin_destination & "\" & $source[$i])

                FileSetTime($chemin_destination & "\" & $source[$i], FileGetTime($chemin_source & "\" & $source[$i], 0, 1), 0)

                FileOpen($log_copie, 1)

                FileWrite($log_copie, @MDAY & "/" & @MON & "-" & @HOUR & ":" & @MIN & " * " & "Rempl. " & $chemin_destination & "\" & $source[$i] & " - taille" & @CRLF)

                FileClose($log_copie)

                ConsoleWrite("Rempl. " & $chemin_destination & "\" & $source[$i] & " - timestamp" & @CR)

            EndIf

        EndIf

    Next

;~     2 - On efface ce qui est sur la cible mais qui n'est plus sur la source

    For $j = 1 To UBound($destination) - 1

        If _ArraySearch($source, $destination[$j]) = -1 Then

            FileDelete($chemin_destination & "\" & $destination[$j])

            DirRemove($chemin_destination & "\" & $destination[$j & "\"], 1)

            FileOpen($log_copie, 1)

            FileWrite($log_copie, @MDAY & "/" & @MON & "-" & @HOUR & ":" & @MIN & " * " & "Suppr. " & $chemin_destination & "\" & $destination[$j] & @CRLF)

            FileClose($log_copie)

            ConsoleWrite("Suppr. " & $chemin_destination & "\" & $destination[$j] & @CR)

        EndIf

    Next

    FileClose($log_copie)

EndFunc   ;==>_copie_compare

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