Rclone cannot move multiple files at once

You're moving two folders, one after the other, so of course it will work.

The bottom line is this needs to be rectified so that it works similar to mv.

@ncw

No, I'm moving two files, one a time.

felix@gemini:~/test$ rclone lsf GD:test
one
two

If you can help me get your use case, it's an easy answer.

It doesn't work like mv in terms of wild carding and that won't change most likely, which is why filters exist. I'm happy to help if you want it.

I will take you up on that. I want to move all folders under, say, media:drop such that there's no leftovers; everything's moved over.

Even better, a way to find all files ending with mkv under the subfolders of drop and move them (and possibly delete the folders from which the mkv files are being moved?? I know its a stretch and its perfectly fine if that can't be done).

I tried making a script, not sure whether it'll work the way its supposed to.

#!/bin/bash
nohup /usr/bin/rclone move media:drop /mnt/1TB/drop --multi-thread-streams 4 -P --transfers=6 --delete-empty-src-dirs > /tmp/move.log &

So like exactly my use case I do every night? :slight_smile:

I have a folder called /local

It contains a structure like:

felix@gemini:/local$ ls
Movies  NZB  seed  TV

I want to move the whole folder Movies and TV every night but I leave NZB and seed so I use an exclude file with this command:

/usr/bin/rclone move /local/ gcrypt: --log-file /opt/rclone/logs/upload.log -v --exclude-from /opt/rclone/scripts/excludes --delete-empty-src-dirs --fast-list --max-transfer 700G --drive-chunk-size=1G

and my exclude is (which has a little left over but you get the idea)

felix@gemini:/opt/rclone/scripts$ cat excludes
*partial~
*sidecar
lost+found/**
torrents/**
seed/**
NZB/**

So that says move everything in all folders, but those items and folders I exclude. When it is done, it deletes any empty src folders not in the exclude so Movies/TV in my example.

1 Like

Q: why do you use /opt ? Don't you have to chown each time you add or delete a file?

I'm an old school unix kind of guy so /opt is a bit legacy but more for when people installed add applications to a server, we used that location. It's stuck with me over the years so my /opt is all my installed applications on my Linux box.

No, once you setup permissions, everything should work fine. My setup is my own non shared server so I basically run everything as a single non root user.

felix@gemini:/$ ls -al | grep opt
drwxrwxr-x  38 felix felix 4096 Mar 10 05:41 opt

felix is the user and runs everything on my server.

There are a million ways to do things and usually just do whatever works best for your brain as this works well for my use case and setup. My setup would not work well for a seed box or something shared :slight_smile:

1 Like

What do the two asterisks indicate? One means anything inside those folders but two means anything under subfolders, recursively?

The ** adds in the / so it grabs any directories down as well.

Use ** to match anything, including slashes (/).

https://rclone.org/filtering/#patterns does a pretty good job. If you have anything to help make things more helpful, we can always make updates to make it better.

I always do my filter testing with just a rclone ls command to validate it does what I want and --dry-run it and finally let it fly after those both first work.

It's usually a bit of trial and error depending on how complex the use case is as I never get it right the first time :slight_smile:

1 Like

So what filter do you think I should use to weed out mkv files under subfolders of a folder?

So I went through the wiki and moveto behaves like mv??

Can you give an example of what your structure looks like and what would be filtered? I'm more a visual person and seeing it would really help.

moveto I believe is more for moving one file and giving it a new name on the other side. I've never really used it.

Sorry, forgot to mention. --include "*.mkv" suits my needs.

But there's another issue I'm facing where I can't delete the folders after the mkv files are moved.

does '--delete-empty-src-dirs' address that?

The folders aren’t empty, so no.

This is confusing then. If the folders aren't empty how would the move delete them? You'd either have to run rclone delete and then rclone rmdirs or you'd need to just run rclone purge and the entire path will be removed. Thats how it works as of now. I'd argue that it would be nice to have a flag to leave the root directory (maybe an enhancement) or to have a flag to have rclone delete also remove the directories in one go (which is probably better actually).

Same way mv works.

In my opinion, purge is a very dangerous command and should include a confirmation prompt like rm -rf /.

If you have 3 files in a directory and you move 3 of them

dir/one.txt
dir/two.txt
dir/three.mp4

mv dir/*mp4 /some/elsewhere

mv wouldn't remove the directory.

No it wouldn’t and it shouldn’t.

In that case, I’d use rclone move remote:to/path path/to --filter “*.mkv” as usual. After that’s done, I’d use rclone delete remote:to/path, which should trash all the contents of path/*, which as of now leaves the folders intact.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.