March 21, 20197 yr Need some help. I'm trying to set up unraid to move any folder larger than 5G in my download folder to a watch folder I have set up with the handbrake docker. Any one know how I can accomplish this? Edited March 21, 20197 yr by Tjlejeune
March 21, 20197 yr Here is a script you can use. Just replace source and target with your folder paths. #!/bin/bash limit=4G source="/mnt/user/source" target="/mnt/user/target" limit=$(echo $limit | cut -d 'G' -f 1) for dir in "$source"/*/ do size=$(du -sBG "$dir" | cut -d 'G' -f 1) if (( $size > $limit )) then echo $size\G $dir \-\> $target mv "$dir" "$target" fi done moveDirBySize.sh Edited May 19, 20197 yr by JoeUnraidUser updated to handle spaces in folder names
March 22, 20197 yr 2 hours ago, Tjlejeune said: Thank you. Works as long as there's no spaces in the folder name Try it now. I updated it to handle spaces in folder names. Edited March 22, 20197 yr by JoeUnraidUser
March 22, 20197 yr Author Oh, quotes were needed around $target. Tried fixing that myself but missed that. Thanks again
Archived
This topic is now archived and is closed to further replies.