[Watford] Bulk Rename Files

Ian Rogers ian.rogers at contactclean.com
Wed Nov 28 01:39:54 UTC 2012


 From the top of my head:

for old in *.gsm ; do
     new=`echo $old | cut -d- -f4`
     mv $old $new
done

Test it first by putting an echo in front of the mv :-)

On 27/11/2012 23:43, Rob Jefferis wrote:
> Hi guys, I have a load of files in a directory with file names similar 
> to below
>
> OUT119-20120702-084956-1341215396.177198.gsm
>
> It is basically OUT(dialingextensionnumber)-DATE-TIME-UNIQUEID.gsm
>
> I would like to somehow bulk rename all the files in this folder to 
> strip everything other than the uniqueid.gsm bit
>
> So in this case I want the file to end up called
>
> 1341215396.177198.gsm
>
>
> Is there a quick way to do this?
>
> Thanks
>
> Rob
>
>
> _______________________________________________
> Watford mailing list
> Watford at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/watford

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/watford/attachments/20121128/f90d487e/attachment.html>


More information about the Watford mailing list