Rclone move/moveto tweaking

I’d like to perform a command similar to the following:

find */* -type f -size -100000k -exec mv -v {} . \; 

basically, moving files inside at least 1 level of sub folders, exclude folders, that has the size of under 100000kbytes, to the current folder.

This works just fine if it is a rclone-mounted folder, but I wanted to execute it natively using rclone move.
I actually wanted to improve it with filtered list (i.e. file extensions that includes “pdf, zip and rar only”

Is this achievable with rclone move/moveto?

I’ve improved the find command a bit:

find */* \( -iname "*.zip" -o -iname "*.rar" -o -iname "*.pdf" \) -type f -size -100000k -exec mv -v {} . \;

but still looking for the answer for rclone, thanks!

Probably but it will involve scripting a moveto for each file… I’d use rclone lsf from the latest beta which produces a much nicer output for scripting

Something like this maybe… (note the echo to print the last command)

rclone lsf --dirs-only . | xargs -d'\n' -i rclone lsf --files-only -R {} | xargs -d'\n' -i echo rclone moveto {} remote:{}

Hmm though that needs the dir from the first xargs in the second…

This will be much less efficient than doing it via a mount though since each rclone invocation needs to do the initial handshake with the cloud storage.

To be more efficient you’d need to do it with rclone move. You’ll also need to use a temporary directory otherwise you’ll get errors with overlapping moves, eg something like this maybe

rclone lsf --dirs-only remote: | grep -v TEMP | xargs -d'\n' -i rclone move --dry-run {} remote:TEMP

You can then put filters on the rclone move like --include '*.{pdf,zip,rar}'

That would probably work!

2 Likes

unfortunately the latest beta seems to be broken…?

-sh: rclone: cannot execute binary file: Exec format error

Did you get the right download for your platform?

https://beta.rclone.org/rclone-beta-latest-linux-amd64.zip

supposedly correct, i used the same arch type binary before (1.39) for my synology server (Intel bromolow)

nvm… “arm”, “amd”…