[TriLUG] File renaming question

Mike Norwood norwoodm at embarqmail.com
Mon Dec 3 12:12:12 EST 2007


Alan,

This seems to work quite well, does just what I need. I will take a look 
at the other suggestion also.

Thanks for the quick replies!

Mike

On Mon, 3 Dec 2007, Alan Porter wrote:

> 
> > I think this should be really easy, but am growing dumber as I age.  I 
> > need to be able to take an undetermined number of files, could be 1 or 2, 
> > could be 30 and move them to another directory as file1, file2, file3, 
> > etc.  The names in the first directory could apparently be anything, 
> > and I am not concerned with the order they are renamed, just as long as 20 
> > files comes out as file1 through file20.
> 
> In bash...
> 
> for x in * ; do c=$(($c+1)) ; mv $x ../tmp2/file$c ; done
> 
> 
> Alan
> 
> 
> 
> 
> 
> 
> .
> 
> 




More information about the TriLUG mailing list