Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Feb 2005 00:28:14 -0800
From:      Mac Mason <mac@cs.hmc.edu>
To:        freebsd-questions@freebsd.org
Subject:   Re: How will I rename every file in a directory to their filenames appending anything?
Message-ID:  <20050204082813.GA4160@orthanc.st.hmc.edu>
In-Reply-To: <20050204082350.17779.qmail@web51610.mail.yahoo.com>
References:  <20050204082350.17779.qmail@web51610.mail.yahoo.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Best handled with a shell loop, offhand:

  % for file in *.mp3 ; do mv $file $file.old ; done

Modifying to suit your tastes.

    --Mac

On Fri, Feb 04, 2005 at 12:23:50AM -0800, Mark Jayson Alvarez wrote:
> Example.
> I would want to rename every file that ends in .mp3 to
> their filename with appended .old.
> 
> so that, test.mp3 will be renamed test.mp3.old?
> my initial command would then be:
> 
> ls |grep mp3 |xargs -J # mv #..[this part is what
> trying to figure out]
> 
> How will I tell the mv that its arguments would be the
> output of ls and append something like ".old" to it?
> ~
> 
> 
> Thanks!
> 
> 
> 
> 	
> 		
> __________________________________ 
> Do you Yahoo!? 
> Yahoo! Mail - You care about security. So do we. 
> http://promotions.yahoo.com/new_mail
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
> 

-- 
Julian "Mac" Mason                            mac@cs.hmc.edu
Computer Science '06                          (909)-607-3129
Harvey Mudd College                      

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (FreeBSD)

iD8DBQFCAzId1AphoTGXiN0RArYeAJ9YvZhLkqyy4iEfv0AynG1LJySkBgCgjU2r
zT/kxaeNWaWTpahteu4OW2k=
=logQ
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050204082813.GA4160>