0

Bulk Rename of Files

Posted by admin on Aug 22, 2009 in Uncategorized

I had a lot of files like .xml.bad which I wanted to rename to .xml perl -e “use File::Copy; map { $y=$x=$_; $x=~s/\.bad//; File::Copy::mv $y,$x; } glob (‘*.bad’);”

Tags:

 
0

Cleaning up files

Posted by admin on Jul 21, 2009 in perl

This is a quick perl one liner to delete files older than 3 days map { unlink $_ if -M > 3 } glob (“old_path/*.bak”);

Tags:

Copyright © 2008-2018 Brinsmead Data Services All rights reserved.