Page 1 of 1

Delete Old File

Posted: 08 Mar 2011 06:09
by darioit
Hello Everybody,

this is a real difficult works, I show you my problem.
I have a lot of image, and sometimes I had to clean all deleted pic.
My photo archive is organized in this way.

Code: Select all

M:
│───────NIKON_D80
│       └───JPG
│           └───2010-02-10
│                 DSC_02345.JPG
│                 DSC_02346.JPG
│           └───2010-02-11
│                 DSC_02347.JPG
│       └───RAW
│           └───2010-02-10
│                 DSC_02345.NEF
│                 DSC_02346.NEF
│                 ....................
│           └───2010-02-11
│                 DSC_02347.JPG
│                 ....................

│───────NIKON_D7000
│       └───JPG
│           └───2010-03-30
│                 _N7K02345.JPG
│                 _N7K02346.JPG
│           └───2010-03-31
│                 _N7K02347.JPG
│                 ....................
│       └───RAW
│           └───2010-03-30
│                 _N7K02345.NEF
│                 _N7K02346.NEF
│                 ....................
│           └───2010-03-31
│                 _N7K02347.NEF
│                 ....................


Before to see my picture I always make a backup on 2 different hard disk, with the same infrastructure directory.

I work usually with JPG (ex. M:\NIKON_D80\JPG\*) directory to view and discard the photos.

My goal is to synchronize the RAW subdir in main disk, and on the other 2 hard disk JPG and RAW subdir,
when some pic is deleted in main disk folder (M:\NIKON_D80\JPG\* and M:\NIKON_D7000\JPG\*)

All directory and file name are without spaces

Could someone help me with this work?

Regards
Dario

[EDIT aGerman] Code tags complemented and formatted to display the structure well. [/EDIT]

Re: Delete Old File

Posted: 08 Mar 2011 16:11
by aGerman
Usually you have to run a DIR /S over the backup, then look for each file whether it still exists on the origin source.

For some reason I didn't understand on which drive letter you delete the files by hand and which drives you try to synchronize :?

Regards
aGerman

Re: Delete Old File

Posted: 09 Mar 2011 01:42
by darioit
Right I must run DIR /S and remove the differences.

on letter M: I delete JPG file, and on letter Y: and X: (backup) I'd like to syncronize with M:

Pheraps software like WinDiff.Exe works fine, but don't delete same file in format NEF

Regards
Dario

Re: Delete Old File

Posted: 10 Mar 2011 15:28
by aGerman
Untested for Y:\

Code: Select all

@echo off &setlocal
for /f "tokens=* delims=" %%a in ('dir /a-d /b /s "Y:\"') do (
  if not exist "M:%%~pnxa" ECHO del "%%~a"
)
pause

Remove the ECHO command if it displays the right files for deleting.

Regards
aGerman