simple question about mv

Guy Harris guy at auspex.UUCP
Sat Jan 28 16:09:34 AEST 1989


>Well, this should work under a Bourne shell:
>$ for i in *.flip
>> do	mv $i `basename $i .flip` .flop
...

Assuming, of course, that all the files are in the current directory,
since "basename" will not only strip off the ".flip", but will also
strip off all the directories leading up to the name (i.e., it will turn
"/usr/src/nemo/cigar.flip" into "cigar", not into
"/usr/src/nemo/cigar"). 

If your system has "dirname", which will strip off the last component of
the name and give you the directory in question, you can use that if
need be.



More information about the Comp.unix.questions mailing list