I need to copy a directory list. I have
dir/2021-01-01/dir2
dir/2021-01-02/dir2
dir/2021-01-03/dir3
...
The dates go from 2021-01-01 until 2021-08-31
Is there any way to do this with only one command, or with filters file.txt?
What is your rclone version (output from rclone version)
1.54.1
Which OS you are using and how many bits (eg Windows 7, 64 bit)
Debian, 64b
Which cloud storage system are you using? (eg Google Drive)
Google Drive
The command you were trying to run (eg rclone copy /tmp remote:tmp)
Hello, and thanks. I have seen an error on my message.
I need to copy a directory list. I have
dir/2021-01-01/dir2
dir/2021-01-02/dir2
dir/2021-01-03/dir2
...
dir/2021-08-31/dir2
Note that the dir2 is the same on all cases. And the data are in Google Drive.
So, is it correct?
rclone copy remote --include='/dir/2021-0{1,2,3,4,5,6,7,8}-??/dir2/**'
Another question is the order of the execution. I need run first the more recent dates:
I have try
rclone copy remote: destination --include='/dir/2021-0{1,2,3,4,5,6,7,8}-??/dir2/'
and it runs ok, but I obtain multiple destination folders of "dir2"
destination/dir/2021-01-01/dir2/
..
destination/dir/2021-08-31/dir2/**
But I wish to combine all on the same "dir2" folder. I'd like to have all files and folders on
destination/dir2/**
Yes,
I have on SOURCE (Google Drive):
temp/2021-08-31/folderA
temp/2021-08-30/folderA
temp/2021-08-29/folderA
...
More than 200 "folderA" in different dates
And I want to merge all "folderA" in one folder in local. With all the contents (subdirs and files)
On DESTINATION I wish: Only "folderA".
Note:
I want to save the more recent file (if the file is duplicate).
Example:
SOURCE
temp/2021-08-31/folderA/file1.doc
temp/2021-03-30/folderA/file1.doc
Then I want on DESTINATION
folderA/file1.doc (the file1 of 2021-08-31)
try rclone ls /path/to/temp --include="/2021-??-??/folderA/**"
get that working first
for the dest, just choose a location like gdrive:folderA
as for most recent files, `rclone copy, by default compares size and mod-time.
if you want to use only mod-time, then add https://rclone.org/docs/#ignore-size
Better, but the problem whit your command is that the result are multiple folders and I only want one folder (merge).
In the example I have got:
temp/2021-08-31/folderA/file1.doc
temp/2021-03-30/folderA/file1.doc
still not sure exactly what you want, need a better example of what the dest should looke like?
does folderA have subfolders? and if yes, what do you want to do with the subfolders?
Ok, I will try to put an easy example.
SOURCE (Google Drive)
proves/2021-01-01/folderA/myfile.jpg
proves/2021-01-01/folderA/subfolderX/document.doc
proves/2021-01-02/folderA/myfile.jpg
proves/2021-01-03/folderA/myfile.jpg
The folderA can have subfolders
All I want on the DESTINATION (local) is:
folderA/myfile.jpg (only the most recent)
folderA/subfolderX/document.doc
I only want one folderA
And I obtain multiple folderA
By now I have obtained the same structure that on SOURCE:
folderA/2021-01-01/folderA/myfile.jpg
folderA/2021-01-01/folderA/subfolderX/document.doc
folderA/2021-01-02/folderA/myfile.jpg
folderA/2021-01-03/folderA/myfile.jpg
I'm not a linux expert either, unfortunately. Just playing around until one appears...
I think something like this should work. It will not be one rclone command, though, it will execute a rclone copy command for each unique directory at level proves/2021-01-01/folderA.
for f in $(rclone lsf --recursive --include="/2021-??-??/folderA/**" --files-only gdrive:proves | cut -d/ -f-2 | sort -ru); do rclone copy $f $(echo $f | cut -d/ -f2) --ignore-existing; done