# This script will hard link all # completed light novels into # the !Completed directory. # # 1. Put this script in the !Completed directory # and save it as completed.sh # # 2. Make it executable: # $ chmod +x completed.sh # # 3. Execute it: # $ ./completed.sh # if [ $(basename "$PWD") != '!Completed' ]; then echo "The script has to be executed in the '!Completed' directory." exit fi cd .. completed=$(curl -s https://pastebin.com/raw/4g2rgkNc | tr -d '\r') while IFS= read -r line; do if [ ! -d "$line" ]; then echo "WARNING: '$line' not found." continue fi echo -n "Hard linking '$line' ..." cd '!Completed' mkdir -p -- "$line" cd "../$line" find . -type d -exec mkdir -p '../!Completed/'"$line/"'{}' \; find . -type f -exec ln -- '{}' '../!Completed/'"$line/"'{}' \; cd .. echo " Done." done <<< "$completed" echo echo "Finished."