I work with a lot of different image dataset and find it helpful if the image files are named in a particular order that I want. Below is the script that will convert all the 'png' files in a folder into frame_%05d.png format.
#!/bin/sh
prefix=$1
count=1
for f in *.png; do
nn=`printf %05d $count`
mv "$f" "frame_$prefix$nn".png
count=`expr $count + 1`
done
Save this script as a .sh file (maybe frameconvert.sh) and then you can run it from command prompt using 'sh frameconvert.sh' . You can modify this script for your own purposes.
#!/bin/sh
prefix=$1
count=1
for f in *.png; do
nn=`printf %05d $count`
mv "$f" "frame_$prefix$nn".png
count=`expr $count + 1`
done
Save this script as a .sh file (maybe frameconvert.sh) and then you can run it from command prompt using 'sh frameconvert.sh' . You can modify this script for your own purposes.
No comments:
Post a Comment