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"
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"
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
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.