mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added a script I'm using for flattening ifttt-downloaded images from Instagram/flickr...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a93047e944
commit
48b7bd8d21
30
scripts/flatten.sh
Executable file
30
scripts/flatten.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
|
SCRIPT_DIR="`dirname $0`"
|
||||||
|
|
||||||
|
# we operate only on the dir the script is in...
|
||||||
|
cd $SCRIPT_DIR
|
||||||
|
|
||||||
|
if ! [ -e "ALL" ] ; then
|
||||||
|
mkdir "ALL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
find . -path ./ALL -prune -o -iregex ".*\(jpg\|png\|gif\)" -printf ./%P\\0 | while read -d '' f ; do
|
||||||
|
echo "$f"
|
||||||
|
to=${f//.\//}
|
||||||
|
mv "$f" "./ALL/${to//\// - }"
|
||||||
|
|
||||||
|
# cleanup...
|
||||||
|
while [[ $f != "." ]] ; do
|
||||||
|
f=`dirname ./"$f"`
|
||||||
|
f=${f//.\//}
|
||||||
|
|
||||||
|
if ! [ "`ls -A ./\"$f\"`" ] ; then
|
||||||
|
echo "removing empty: $f"
|
||||||
|
rmdir ./"$f"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user