By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!I have tried for some time, without much success, to do a btm file which will delete all files on Drive 2 that are not on Drive 1. (I'm using 4NT.)
SYNC /W
should work, if you have a new enough version of 4NT. I'm can't remember when it was added, and it's not in the LE version of TCC.Code:SYNC /W
> ---Quote (Originally by mtotman)---
> Code:
> ---------
> SYNC /W
> ---------
> should work, if you have a new enough version of 4NT. I'm can't remember
> when it was added, and it's not in the LE version of TCC.
> ---End Quote---
> Thanks - as I understand it, SYNC /W will copy newer files from dir2 to
> dir1, and therefore from the destination drive to the source drive.
> Though that's usually no problem, I want an absolutely 1-way process from
> drive 1 to drive 2. On rare occasion I'll have a newer version of a file
> on the backup drive that I want to get rid of, not bring onto the source
> drive.
> | Then why not just delete the contents of the directory on drive 2 &
> | then
> | copy the directory on drive 1 to the directory on drive 2?
>
> What if you have 40GB of identical data already duplicated on both drives?
> You'd not want to delete and copy again all of that...
There's not a lot of difference timewise in having to check the date, time,
and size of the files versus just copying them regardless.
(And if the OP is trying to sync 40GB every day, he should probably rethink
the entire process ...)
Rex Conn
JP Software
I have tried for some time, without much success, to do a btm file which will delete all files on Drive 2 that are not on Drive 1. (I'm using 4NT.) I don't need to check for anything but file-names. Any help with this much appreciated.
Here is a script I use to prune files I back up to my O: flash drive.
rconn wrote:
[...]
Here is a simple _U_N_T_E_S_T_E_D_ batch program to eliminate all files on
drive 2 which do not
exist on drive 1:
REM P1 is the full path on drive 1 of the top-level source directory
REM P2 is the full path on drive 2 of the top-level target directory
cdd "%P1"
global/i/n gosub DIRTEST
quit
:DIRTEST
set d1=%@replace[%P2,%P1,%_cwds]
do f2 in *
if not isfile "%d1\%f2" del "%f2"
enddo
--
HTH, Steve
I'm guessing they probably figured it out at some point in the last 7 years since the previous post.How about a nice BTM that would be called and checked for params
set DRIVE2=d:\backup
set DRIVE1=C:\temp
dir /esb /a:-d /Nj "%DRIVE2%" | for %FILE in (@CON:) DO if not exist "%@replace[%@UPPER[%DRIVE2%],%DRIVE1%,%FILE]" del /n /a: /f /y " %FILE%"