Hi Terry,

> Been away doing my exercises :-)

Bit early for pintlifting?

> Obviously I was wrong.

I think so.  Assuming there are no linefeeds in the filenames, this will
show a count of duplicate filenames.

    find -type f -printf '%f\n' | sort | uniq -dc

> I'd like to overwrite them and carry on.

Removing the -i from mv will remove the interactive prompt.
mv will then overwrite by default unless the destination is read-only.
Passing -f to mv will force it to overwrite a read-only destination.
Don't put the -f between the -t and its $PWD argument.

> Does this mean I can rerun the commands on the partially converted stick 
> without loss?

Yes, I'd have thought so.  You'll see complaints from mv about source
and destination being the same file.  You could instead add a -mindepth
option to find so what follows is only applied two levels down from the
implicit ‘.’ directory argument where it starts.

    find -mindepth 2 -type f -exec mv -t $PWD {} +

-- 
Cheers, Ralph.

-- 
  Next meeting: Online, Jitsi, Tuesday, 2025-07-01 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  https://dorset.lug.org.uk
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to