Skip to content

Instantly share code, notes, and snippets.

@chenkaie
Last active December 22, 2015 13:59
Show Gist options
  • Save chenkaie/6483032 to your computer and use it in GitHub Desktop.
Save chenkaie/6483032 to your computer and use it in GitHub Desktop.
Description: 無名小站相片打包程式 (download_wretch_album.sh) Ref: http://www.wretch.cc/blog/WretchFAQ/13637278
#!/bin/bash
# Modify below 2 variables if needed
ALBUM_NUM=50
ALBUM_FOLDER="./SambaGhost-data/album/"
cd ${ALBUM_FOLDER}
for (( i = 1; i <= ${ALBUM_NUM}; i++ )); do
echo "==> Create folder ${i}"
mkdir ${i}
cd ${i}
echo "==> Download album ${i}.txt"
wget -q -i ../${i}.txt
echo "==> Batch file rename"
for pic in `ls`; do
mv $pic $(echo $pic | cut -d '?' -f 1)
done
cd -
done
echo "==> Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment