# Copying a folder which have two subfolder having same name

I wanted to copy a shared folder having two subfolder of same name and I wanted to exclude one of them(marked red in image) as it is of big size and my destination does not have that much storage.

And I have folder id but I am not able to filter that using folder id.

When I do filter using name, then both GATE folder got excluded.

And I want one of the GATE to be copied to my destination.

I have a long way solution for this.

hi,
if this is a one time thing?
if so, perhaps rename one of the folders.

This is in shared folder and i have no any admin rights.
So I can't.

well then, this is a good question.

i have no idea what to do, but it got me thinking?

I don't think you can do this directly with rclone at the moment. Rclone doesn't like duplicated file names very much - Google drive is pretty much unique in allowing duplicated file names!

The best I can think of is this

  --exclude-if-present string   Exclude directories if filename is present
1 Like

I have to paste folder id in place of string. Right?
Let me try and give feedback here.
Thanks

Edit:Not worked...
So I have gone for long way🙂

perhaps you can run a couple of rclone commands.

rclone copy gdrive: dest: --exclude="/GATE/**"

and then rclone copy based on folder id what you want to use

rclone lsf -R gdrive: --format=pi
GATE/;13OwXfj31grF8LVthTlOVDWliJOJJnwOH
GATE/;1pH0fhYAtSOmD0gr-fJw2dmZtyv-xvG5X
GATE/GATE2/;1TvSMfVKiaVbuSIggumAg9QnPA87os6s5
GATE/GATE1/;1Nshu90SduTF6FpSorI68NMZCimzofSFR

set RCLONE_DRIVE_ROOT_FOLDER_ID=13OwXfj31grF8LVthTlOVDWliJOJJnwOH
rclone copy C:\path\to\local\folder\gate1\gate1.txt gdrive:\ -v
2020/04/04 14:07:02 INFO : gate1.txt: Copied (new)
2020/04/04 14:07:02 INFO :
Transferred: 1 / 1 Bytes, 100%, 1 Bytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 0.7s

set RCLONE_DRIVE_ROOT_FOLDER_ID=1pH0fhYAtSOmD0gr-fJw2dmZtyv-xvG5X
rclone copy C:\path\to\local\folder\gate2\gate2.txt gdrive:\ -v
2020/04/04 14:07:03 INFO : gate2.txt: Copied (new)
2020/04/04 14:07:03 INFO :
Transferred: 1 / 1 Bytes, 100%, 1 Bytes/s, ETA 0s
Transferred: 1 / 1, 100%
Elapsed time: 0.8s

set RCLONE_DRIVE_ROOT_FOLDER_ID=
rclone lsf -R gdrive: --format=pi
GATE/;13OwXfj31grF8LVthTlOVDWliJOJJnwOH
GATE/;1pH0fhYAtSOmD0gr-fJw2dmZtyv-xvG5X
GATE/gate1.txt;176WKQ_oxD9qWCPf08Saru7iSkN1WBK7O
GATE/GATE1/;1Nshu90SduTF6FpSorI68NMZCimzofSFR
GATE/GATE2/;1TvSMfVKiaVbuSIggumAg9QnPA87os6s5
GATE/gate2.txt;1PYoTRU-XUI8XcBelphvF0FeKqdGi_BFi

1 Like

I have mentioned in the post that I have a long solution for this.
And this is it.

My copying process is completed now.

Btw thanks for effort.

Hey I was trying ur command but not seems to be working .
Where are u running this command?
I am running in termux.

Can u post ur screenshot?
The process i have followed for cooying was working for gdrive to mega but that same command is not working for gdrive to gdrive.

I don't know why.

I will ask in different questions today with screenshot.

You put in the name of a file in the directory you wish to exclude.

A long way is still a way! Glad you got it done.

in the end, did you accomplish what you needed?

on my windows computer.
those command will not run on liunx or termux.
you would have to tweak the commands.

a screenshot of what?

i posted the commands and their output.

so i have been trying to learn more about linux.
so i converted my windows .cmd script to a liunx .sh script

the .sh runs under

1. windows subsystem for linux
2. termux

here is the .sh file

rclone lsf -R gdrive: --format=pi

export RCLONE_DRIVE_ROOT_FOLDER_ID=redacted
rclone copy ~/path/to/local/folder/gate1/gate1.txt gdrive:/ -v

export RCLONE_DRIVE_ROOT_FOLDER_ID=redacted
rclone copy ~/path/to/local/folder/gate2/gate2.txt gdrive:/ -v

export RCLONE_DRIVE_ROOT_FOLDER_ID=
rclone lsf -R gdrive: --format=pi


and here is the output from termux

\$ ./test.gate.sh
GATE/;redacted
GATE/;redacted
GATE/GATE1/;redacted
GATE/GATE2/;redacted
2020/04/05 16:33:15 INFO  : gate1.txt: Copied (new)
2020/04/05 16:33:15 INFO  :
Transferred:             1 / 1 Bytes, 100%, 0 Bytes/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         1.1s

2020/04/05 16:33:17 INFO  : gate2.txt: Copied (new)
2020/04/05 16:33:17 INFO  :
Transferred:             1 / 1 Bytes, 100%, 1 Bytes/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         0.9s

GATE/;redacted
GATE/;redacted
GATE/GATE2/;redacted
GATE/gate2.txt;redacted
GATE/gate1.txt;redacted
GATE/GATE1/;redacted

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