Updated June 22, 2005
Created June 22, 2005
Autogenerated Site Map
Search this Site!:
The following determines the file type and gives a shortened name w/ extension.
Sample input:
./main.php?g2_view=core:DownloadItem&g2_itemId=70&g2_serialNumber=1
./main.php?g2_view=search:SearchScan&g2_form[useDefaultSettings]=1&g2_return=http:%2F%2Fwww.wassons.org%2Fgallery2%2Fmain.php?g2_view=core:ShowItem&g2_itemId=62&g2_returnName=photo
./main.php?g2_view=core:ShowItem&g2_itemId=56&g2_fromNavId=xb6227630
./main.php?g2_view=core:ItemAdmin&g2_subView=slideshowapplet:SlideshowApplet&g2_itemId=32&g2_fromNavId=xe4a078ac
./main.php?g2_view=core:ItemAdmin&g2_subView=slideshowapplet:SlideshowApplet&g2_itemId=74&g2_fromNavId=xa179a92a
./main.php?g2_view=core:UserAdmin&g2_subView=core:UserRecoverPassword&g2_navId=xeebd7630
./main.php?g2_view=core:UserAdmin&g2_subView=core:UserRecoverPassword&g2_navId=xb81f57e1
./main.php?g2_view=core:ShowItem&g2_itemId=7&g2_page=1&g2_fromNavId=x5e67a805
./main.php?g2_view=core:ShowItem&g2_itemId=50&g2_fromNavId=x81b23f49
./main.p
Sample output:
image.033.jpg
image.034.jpg
image.035.gif
image.036.png
image.037.gif
image.038.png
image.039.gif
image.040.gif
image.041.jpg
image.042.jpg
Script - all on 1 line:
mkdir /tmp/pics; cd /tmp/mysourcedir; COUNT=0; find . -type f | while read; do MYTYPE=`file "$REPLY"`; echo "$MYTYPE" | grep "image data" >/dev/null || continue; echo "$MYTYPE" | grep GIF && MYEXT=gif; echo "$MYTYPE" | grep JPEG && MYEXT=jpg; echo "$MYTYPE" | grep PNG && MYEXT=png; if [ -z "$MYEXT" ]; then MYEXT=unknown; fi; ln "$REPLY" /tmp/pics/image.`printf "%03g" $COUNT`.$MYEXT; COUNT=`expr $COUNT + 1`; done
Script - cleaned up:
mkdir /tmp/pics
cd /tmp/mysourcedir
COUNT=0
find . -type f | while read; do
MYTYPE=`file "$REPLY"`
echo "$MYTYPE" | grep "image data" >/dev/null || continue
echo "$MYTYPE" | grep GIF && MYEXT=gif
echo "$MYTYPE" | grep JPEG && MYEXT=jpg
echo "$MYTYPE" | grep PNG && MYEXT=png
if [ -z "$MYEXT" ]; then MYEXT=unknown; fi
ln "$REPLY" /tmp/pics/image.`printf "%03g" $COUNT`.$MYEXT
COUNT=`expr $COUNT + 1`
done
If you get any "unknown" entries then add a line for the unknown file type next to gif, jpg, and png.
Search this Site!:
Homepage: http://www.cpqlinux.com
Site Map: http://www.cpqlinux.com/sitemap.html