How to move all root files a directory

on linux, we want to move all files into thedestfolder.

here is the folder structure.

rclone lsd b201:
          -1 2021-03-18 16:48:16        -1 thedestfolder
          -1 2021-03-18 16:48:16        -1 thesourcefolder01
          -1 2021-03-18 16:48:16        -1 thesourcefolder02

here are the files

 rclone ls b201:
        1 thedestfolder/dest01.txt
        1 thedestfolder/dest02.txt
        3 thesourcefolder01/01.txt
        3 thesourcefolder02/02.txt

create a list the files we want to move
rclone lsf b201: --format=p --files-only --recursive --exclude=/thedestfolder/** > list.txt

here what the list.txt looks like

thesourcefolder02/02.txt
thesourcefolder01/01.txt

now we move those files.

for f in `cat list.txt`
do 
	rclone moveto b201:$f b201:thedestfolder/$f -vv
done

and here the list of files after that.

rclone ls b201:
thedestfolder/dest01.txt
thedestfolder/dest02.txt
thedestfolder/thesourcefolder01/01.txt
thedestfolder/thesourcefolder02/02.txt

this does work with server-side move, really a server-side copy and then a server-side delete

INFO  : 01.txt: Copied (server-side copy)
INFO  : 01.txt: Deleted
1 Like