Set up a conditional statement (if/else)

I’m looking for a statement that would assess size of file and determine based on that if it should be moved to eacd or local storage… in other words, if $FILE > 10GB then MOVE to EACD else MOVE to local storage.

is there a way to do this?

You can use find for this.

find /path/to/files -type f -size 2048M -exec rclone move {} remote:/some/path \;
1 Like

thanks for the response! just to clarify tho…

/path/to/files = is where the file is presently, right?

rclone moves file to remote if its greater than 2048M?

what if its not greater than 2048? is there another statement that allows me to move file to /some/local/path?


Sorry, you’re right 2048M will just target that size. You can use +2048M for files greater than that size.

/path/to/files is the local path you’re look through.

So, you’d need 2 statements really.

find /path/to/files/to/sort -type -f -size +2048M -exec rclone move {} remote:/path/to/sort/to \;


find /path/to/files/to/sort -type -f -size -2084 -exec mv {} /local/path/to/sort/to \;
1 Like

Actually, check out the --min-size argument for rclone. That will likely serve you better than a find. It’ll lower your overhead significantly.

For the remainder you can use rclone to copy to a local mount if you like.

1 Like

There is also --max-size and --min-size in rclone.

1 Like

trying to do the copy based on size, but hasn’t worked… anything wrong w/ my code below?

rclone move /home/temp/.hardlinks/ eacd: --min-size 8G --no-traverse --transfers 10 --quiet
rclone move /home/temp/.hardlinks/ /home/Media/ --max-size 8G --no-traverse --transfers 10 --quiet

What happens if you just run this:

rclone ls /home/temp/.hardlinks/ --min-size 8G

Does it output anything?

it does yes john… it outputs the name of a file that meets the condition.

when i run the move command against it tho i get the following errror:

invalid cross-device link