[Watford] Bulk Rename Files
Alain Williams
addw at phcomp.co.uk
Wed Nov 28 00:41:24 UTC 2012
On Tue, Nov 27, 2012 at 11:43:05PM +0000, 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?
Using ksh
for file in *.gsm
do mv $file ${file#~(E:+(OUT+(\d)-+(\d)-+(\d)-))}
done
The syntax is a little strange.
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>
More information about the Watford
mailing list