2 drives
o: (original), b: (backup)
at the beginning the o: and b: are exactly the same
have large files (eg. home videos) on o: and im moving them to different directories on o: only.
That means, all files on o: are still backuped on b:, but they are located in wrong folders.
I want to make o: and b: exactly the same again, by MOVING files on b: to proper folders.
Dont want to copy anything from original disk to backup one, because copying takes looong time.
Want only move files inside the b: drive to proper directory, because moving on SAME disk is fast.
Code: Select all
list1:="c:\list1"
list2:="c:\list2"
;lists examples:
;- ___list1:___ ___list2:___
;- index.php201410200857464782|i:\index.php index.php201410200857464782|j:\index.php
;- project.properties20140815152635141|i:\root\project.properties project.properties20140815152635141|j:\project.properties
;- project.xml20140815152635322|i:\root\project.xml project.xml20140815152635322|j:\root\project.xml
;- soubor.ke.kopirovani.txt201410201105378|i:\soubor.ke.kopirovani.txt soubor.ke.kopirovani.txt201410201105378|j:\root\soubor.ke.kopirovani.txt
Loop, read, %list1%
{
i=%A_LoopReadLine%
Loop, read, %list2%
{
j=%A_LoopReadLine%
; i is Source, j is Destination
StringSplit, arrayS, i,|
StringSplit, arrayD, j,|
if ( arrayS1 = arrayD1) { ;if same files
Source = %arrayD2%
Dest:= RegExReplace(arrayS2, ".(.+)", "j$1") ; arrayS2 but another drive
FileMove, %Source%, %Dest%, 0 ;-(1 = overwrite)
;todo: remove line from both lists-will this help?
break
}
}
}