On 24 Jan 16:24, Chris Green wrote:
On Tue, Jan 24, 2012 at 03:23:06PM +0000, Brett Parker wrote:
On 23 Jan 22:03, Chris Green wrote:
I suspect I'm going to have to write a utility to do this for me but there *might* be something to do it for me.
I want to spot files missing from a sequence, e.g. if I see:-
dscf1253.jpg dscf1254.jpg dscf1256.jpg dscf1257.jpg dscf1258.jpg dscf1259.jpg
I want to be told that dscf1255.jpg is missing.
Very simple starter for bash...
for file in $(seq -f "dscf%0.f.jpg" 1253 1259); do if (! ls "$file" >/dev/null 2>&1 ); then echo "Missing $file" fi done
Obviously, with a minimal amount more work you could make that better, but that's one just off the tips of my fingers.
They're not all in one directory, they're spread all over an extensive and quite deep hierarchy.
What I have done (as it's just a one off to check for missing files) is to go to the top of the hierarchy and do:-
find . -name 'dscf*.jpg' -exec basename {} \; | sort >list
Then load the file list into an editor and go through the list checking that dscf1234.jpg is on line 1234 of the file, shows up multiple copies of the same file as well as missing files.
Useless use of exec...
find . -name 'dscf*.jpg' -printf "%f\n" | sort > list
Would have been quicker ;)