PPRuNe Forums - View Single Post - Batch renaming file extensions (Mac)
View Single Post
Old 25th June 2013 | 08:40
  #5 (permalink)  
mixture
 
Joined: Aug 2002
Posts: 3,663
Likes: 0
From: Earth
SHJ,

There is no such thing as a unix executable file as such, so I'm guessing you meant the windows ".exe" ?

Disclaimer : Although I've put an anti-fat-finger step in the below, I would still encourage you to use your preferred backup routine before proceeding !

(1) Identify the absolute location of the files

• Right click on file & select "Get Info" (or just highlight file and hit "cmd-I")
•*Make a note of the value given to you in the "Where" field

(2) Fire up Terminal

• Applications -> Utilities -> Terminal
• Change directory to the directory above the one given in the where field.
e.g. for /Users/mixture/Desktop/random you would enter
Code:
cd /Users/mixture/Desktop
•For your own sanity, create a compressed archive of the folder you're about to tamper with (the below is based on the directory name above, change to suit your own):
Code:
tar cvf random_25June013.tar random/
Code:
gzip -9 random_25June013.tar
You should see your filenames streaming by on the screen. Second line is not strictly necessary, it doesn't have much effect on image files anyway, but you might as well compress them as much as possible.
•Enter the dragons lair …
Code:
cd random
•enter the following……
Code:
for i in *exe; do j=`echo $i | sed 's/exe$/jpg/g'`;mv "$i" "$j";done
Important note re: the above, note the difference between backticks and single quote !

Last edited by mixture; 25th June 2013 at 09:27.
mixture is offline  
Reply