New linux user - just a question on syntax

Hi everyone,

I've successfully setup my first remote. I've running a new server which doesn't have too much data, so I wish to sync the entire thing to my remote - all files and directors. Would the correct command to copy everything from the root director outwards be:

rclone copy . remotename:backupfolder

I'm not sure if I should be using just . or ./ to capture the entire drive.

Thank you very much.

Let's say you have folders stored in /home/user/Media and you'd like to backup to your remote. I'd say you'd issue 'rclone copy /home/user/Media remote:/path/to'. But you'd probably like to not have repeats so then after the first time you'd do 'rclone copy --ignore-existing /home/user/Media remote:/path/to'.

if you want the root then you want to use / rather than .. . will copy the current directory which can be useful.

Note that if you copy from the root you want to avoid the synthetic file systems /proc /sys/ /dev.

Supplying the -x flag will help with this

-x, --one-file-system Don't cross filesystem boundaries (unix/macOS only).

So rclone copy -x / remote:backupfolder

You'll probably want -l too to copy the symlinks.

You won't get repeats - rclone checks to see if the file is uploaded so you don't need --ignore-existing. If you supply --ignore-existing then rclone won't update a file that already exists on the remote.

This is not quite my experience. If I just issue a rclone copy without ignore, what happens is I get two copies of the same file from the same directory. I've mostly mitigated this with hardlinks but still. It happens.

You definitely shouldn't get that, the copy shoud notice the file is there already and skip it. I assume you are talking about google drive as a backend?

What command line are you using?

Wonderful, thank you for your answers!

Another quick one, I've installed on Ubuntu following the documentation. I'm now wanting to set up a crontab to do a daily sync. In my backup.sh file, I need to specify the location that rclone is installed. What is the default path? I'm following this syntax:

# !/bin/sh
/full/path/to/rclone sync /path/to/backup remoteame:backupfolder
1 Like

Depends on how you installed it, but which rclone will show the path it is installed at.

That worked, thank you.

One final question, I promise. I'm attempting to exclude a particular directory and all subdirectories, but so far it's not working. My exclude-file.txt specifies this:

secrets.yaml
/home/efleming/Downloads/**

The exclude-file.txt is being picked up because secrets.yaml is not being copied, so the way I'm putting the path is obviously wrong.

Can you share the full command that you are running and run that command with -vv and sharer the output?

So my exclude-file.txt as above. The command to reference it as follows:

rclone sync -l --exclude-from /home/exclude-file.txt /home/efleming erithonedrive:/erithserver/home/efleming

Can you run it with -vv and --dump filters

Here's the relevant output:

--- start filters ---
--- File filter rules ---
- (^|/)secrets\.yaml$
- ^home/efleming/Downloads/.*$
--- Directory filter rules ---
- ^home/efleming/Downloads/.*$
--- end filters ---

Link to actual log too:

https://1drv.ms/t/s!AmSXn9Hhyh9bgs5s5C6J0ic8zKtB5w?e=RkWQL9

Rclone excludes are relative to the start of the sync, so you want this to exclude Downloads at the root of the sync

secrets.yaml
/Downloads/**

That will exclude every secrets.yaml in every directory - was that what you wanted?

No, sorry. It's essentially two different exclusions I'm after. The first being to exclude secrets.yaml (which is in a different directly). That one is working.

The second is to ignore the /Downloads/ folder and everything in it and all subdirectories. These contain a number of large video files I don't desire to backup. So that's where I'm tripping up, as Rclone is till syncing those to my cloud.

What I wrote above should work then, provided the Downloads directory is at the root of the sync.

Don't forget the --dry-run flag, it's super helpful.

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