Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Batch Script to Convert PNG to XPM

Operating Systems


Reply
 
Thread Tools Search this Thread
  #1  
Old 22-08-2010
Member
 
Join Date: Jul 2010
Posts: 76
Batch Script to Convert PNG to XPM
  

I am able go with the convert command for the conversion of a single image from PNG to XPM, but unable to get (my previous) script to be in functioning. I need the same to convert a directory of PNGs to XPM. Any suggestion would be appreciated. Thank you very much !

Quote:
echo "Script Starting.."
cd /home/user/Pictures/icons
echo "start For loop"
for pic in 'ls *.png'
do
echo "converting $pic"
convert $pic $pic.xpm
done
echo "finished"

Reply With Quote
  #2  
Old 22-08-2010
Member
 
Join Date: Nov 2005
Posts: 3,025
Re: Batch Script to Convert PNG to XPM

Do you get what I have performed at that place ? There are two characters in red that were single quotes in your code, have been reverted into the backticks. That is placed on the same key onto the standard system keyboard as the tilde ~ is, in the above left corner.

I would suggest that you make the difference more obvious, by performing the same instead:

echo "Script Starting.."
cd /home/user/Pictures/icons
echo "start For loop"
for pic in $(ls *.png)
do
echo "converting $pic"
convert $pic $pic.xpm
done
echo "finished"
Reply With Quote
  #3  
Old 22-08-2010
Member
 
Join Date: Apr 2008
Posts: 4,097
Re: Batch Script to Convert PNG to XPM

That should resolve the complexities . But there will be single minor flaw. File aaa.png would be converted, for instance , and the name of the newly generated file will be aaa.png.xpm. I am just considering that you need, instead, aaa.xpm. If that is the situation, you have to modify the lines in suggested .

for pic in $(ls *.png)
do
echo "converting $pic"
convert $pic $(basename $pic.xpm .xpm)
done
__________________
Ram requirement for various OS
Reply With Quote
  #4  
Old 22-08-2010
Member
 
Join Date: Jul 2010
Posts: 237
Re: Batch Script to Convert PNG to XPM

Thank you very much for the suggestion and I never would have got the tick mark (vs) quote issue. The script executes and I receive the "converting pic" messages as every file is getting processed. But I never search the output/xpm files. The script permission configured as 755, and I have executed the same as root and user. But still I am not getting any files. I am again reading the documentation on permissions (I considered that is the issue) but if you suspect some other issues please let me know about this . Thanks again.
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems
Tags: , , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Batch Script to Convert PNG to XPM"
Thread Thread Starter Forum Replies Last Post
Batch Script Issue spmaguire Software Development 3 04-09-2013 10:41 AM
Encrypt batch script content Aaliya Seth Software Development 4 01-04-2010 01:10 PM
Batch script to delete directory Logan 2 Software Development 4 01-04-2010 12:31 PM
Need a batch script to map drive Common Networking & Security 3 06-07-2009 07:42 PM
How can I play a Wav file from batch/cmd script? NaFula Windows Vista Performance 3 13-09-2008 09:21 PM


All times are GMT +5.5. The time now is 11:05 AM.