PPRuNe Forums - View Single Post - Batch renaming file extensions (Mac)
View Single Post
Old 25th June 2013 | 12:02
  #7 (permalink)  
mixture
 
Joined: Aug 2002
Posts: 3,663
Likes: 0
From: Earth
Complicated in Mac, it seems!
Erm, no...

You can skip half my steps. As I said, half of them are only there for fat-finger protection purposes... you could just do

Code:
cd /Users/mixture/Desktop/folder
(which you would have to do on windows anyway)

then...

Code:
for i in *exe; do j=`echo $i | sed 's/exe$/jpg/g'`;mv "$i" "$j";done
There are 101 other ways to do that line. Some shorter, some longer.... I just picked that one.

Sure there's no "rename" command, but yah boo sucks.... what it does mean is you've got more powerful options available to you .... e.g. you can do file renames via the find command ....which means you can do fancy tricks with the atime/mtime and other flags.... in Windows you would probably have to resort to multiple lines of PowerShell scripting, whilst on Mac it can be done in a short one-liner.

There's also nothing stopping you writing a script called "rename" on a Mac and using that with appropriate input arguments.

Last edited by mixture; 25th June 2013 at 12:13.
mixture is offline  
Reply