how we can copy using rclone with regular expression
suppose we have file name
CLIENT_DELTA.20210710.A901
we have multiple file here with date and .A901
so what our requirement we need to filter file using "20210710" and at the end of file name "A901"
how we can copy all the files with this info from remote folder to avoid extra files copied to our server and choke the network
What is your rclone version (output from rclone version)
rclone v1.56.0
Which cloud storage system are you using? (eg Google Drive)
rclone copy data using SFTP on port 22 from remote Linux server
The command you were trying to run (eg rclone copy /tmp remote:tmp)
I tried with below command but not worked
rclone copy --include=*.{\20210916\20210917\20170425}.A901 --sftp-host=remote_server :sftp:/incoming/ --sftp-user=minio --sftp-pass='' /datasync/demo1 --log-file=/var/log/rclone/rclone_pull.log -vvv -P
these are the files there
DWH.2MMO.SERVICE_AGREEMENT.20210702.A901
mkp_DWH.3MMC.BILLING_PARAMETERS.20180723.A901
DWH.3PUC.SERVICE_AGREEMENT.19000101.A901
DWH.3MMC.SERVICE_AGREEMENT.19000101.A901
DWH.3MMC.BILLING_PARAMETERS.20210415.A901
DWH.3MMC.BILLING_PARAMETERS.20180723.A901
DWH.2PUA.SERVICE_AGREEMENT.19000101.A901
DWH.2MMO.SERVICE_AGREEMENT.19000101.A901
DWH.2MMO.BILLING_PARAMETERS.20180723.A901
DWH.2MMO.BILLING_PARAMETERS.20170425.A901
I ran the command
rclone ls /opt/SP/minio/datasync/demo1 --include=.{\d\d\d\d\d\d\d\d}.A901 -vv
2021/10/05 18:20:03 DEBUG : rclone: Version "v1.56.0" starting with parameters ["rclone" "ls" "/opt/SP/minio/datasync/demo1" "--include=.{dddddddd}.A901" "-vv"]
2021/10/05 18:20:03 DEBUG : Creating backend with remote "/opt/SP/minio/datasync/demo1"
2021/10/05 18:20:03 DEBUG : Using config file from "/opt/SP/miniousr/.config/rclone/rclone.conf"
2021/10/05 18:20:03 DEBUG : DWH.2MMO.SERVICE_AGREEMENT.19000101.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.2MMO.SERVICE_AGREEMENT.20210702.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.2MMO.BILLING_PARAMETERS.20170425.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.2PUA.SERVICE_AGREEMENT.19000101.A901: Excluded
2021/10/05 18:20:03 DEBUG : mkp_DWH.3MMC.BILLING_PARAMETERS.20180723.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.3MMC.BILLING_PARAMETERS.20210415.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.3PUC.SERVICE_AGREEMENT.19000101.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.2MMO.BILLING_PARAMETERS.20180723.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.3MMC.SERVICE_AGREEMENT.19000101.A901: Excluded
2021/10/05 18:20:03 DEBUG : DWH.3MMC.BILLING_PARAMETERS.20180723.A901: Excluded
2021/10/05 18:20:03 DEBUG : 2 go routines active
That is a very interesting answer and shouldn't work at all because rclone filter strings are file globs not regexps.
However it does work...
I think the reason it works is actually a bug. Rclone translates the filters into regular expressions (you can see them with -vv --dump filters), but it is dumping the \d straight into the regexp which it shouldn't be - it should be escaping the \..
This means that any of the regexp \ chars will work in the glob which wasn't unintended certainly!
So I should probably either document this or fix it....
(I keep meaning to make an alternate syntax which can be a regexp for filters - my best idea for not breaking too much stuff is to allow regexp in the --filter family of commands, so instead of writing --filter + blah you'd write --filter r+ .*\d{5})
anyway to copy this patterns of file via rclone as rclone copy working only when we are giving full path and file name only , how I can use the path and this file pater to copy this path rclone reading from github
I am reading one config file from github using curl and its having this path mentioned .
"/opt/SP/edwdata/ab_data_mount/main/serial/VFDE/public/DWH_PUB/main/mozart/incoming/DWH.2MMO.SERVICE_AGREEMENT.????????.A901"
rclone not able to copy directly with this patern without using include or filter , things is file name and path could be change every time , any way we can filter the file name , uning ???? and put the filter filename into --include=DWH.2MMO.SERVICE_AGREEMENT.????????.A901 like this to done the rclone copy job