[X4U] Deleting part of file names

Eugene list-themacintoshguy at fsck.net
Mon Jun 6 22:20:33 PDT 2011


On Mon, Jun 06, 2011 at 09:55:54AM CDT, Jim Moldenauer <m1sc at wi.rr.com> wrote:
> 
> How do you delete the first 10 words of the file names? I have over
> 200 files with the same first 10 letters. The rest of the names are
> alphabetical but the first 10 letters are redundant.
> Command F (find) won't do it. I read up on AutoScript but that looks
> like it do it if it was folders. I could not see where I could do it
> with file names. It probably would if I could understand it. It
> doesn't speak about file names in particular. This is strange because
> I can't find out how to eliminate them. Any help would be appreciated.

At a shell command line:

shell> cd <directory-containing-the-redundantly-named-files>

shell> for a in *; do b=`echo "$a" | sed 's/^abcde12345//'`; mv "$a" "$b"; done

where "abcde12345" are your "first 10 letters".


-- 
Eugene
http://www.coxar.pwp.blueyonder.co.uk/


More information about the X4U mailing list