Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LOG_FILE="/var/lib/transmission-daemon/info/torrents/aria2_done.log"
- BASE_DIR="/mnt/DataVolume/Torrents"
- [ -z "$1" ] && exit
- echo "Called with GID:[$1], Num of files:[$2], File path:[$3]." >> $LOG_FILE
- # $1 GID:[9937097281ed1643],
- # $2 Num of files:[21],
- # $3 File path:[/mnt/DataVolume/Torrents/Folder with spaces/Redist/DirectX/dsetup32.dll]
- if [ "$2" = "1" ] && [ "$(dirname "$3")" = "$BASE_DIR" ]; then
- # Torrent with one file only
- chmod 666 "$3"
- else
- cur_dir="$(dirname "$3")"
- while [ "$cur_dir" != "$BASE_DIR" ] && [ "$(dirname "$cur_dir")" != "$BASE_DIR" ]; do
- cur_dir="$(dirname "$cur_dir")"
- done
- echo "Torrent dir is: $cur_dir" >> $LOG_FILE
- find "$cur_dir" -type d -exec chmod 777 {} \; >> $LOG_FILE
- find "$cur_dir" -type f -exec chmod 666 {} \; >> $LOG_FILE
- fi
Add Comment
Please, Sign In to add comment