"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
local: make using -l/--links with -L/--copy-links throw an error #1152
Nick Craig-Woode317f0409878
diff --git a/backend/local/local.go b/backend/local/local.goindex a17a0cf53..039d5d86e 100644--- a/backend/local/local.go+++ b/backend/local/local.go@@ -142,6 +142,8 @@ type Object struct {// ------------------------------------------------------------+var errLinksAndCopyLinks = errors.New("can't use -l/--links with -L/--copy-links")+// NewFs constructs an Fs from the pathfunc NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {// Parse config into Options struct@@ -150,6 +152,9 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) {if err != nil {return nil, err}+ if opt.TranslateSymlinks && opt.FollowSymlinks {+ return nil, errLinksAndCopyLinks+ }if opt.NoUTFNorm {fs.Errorf(nil, "The --local-no-unicode-normalization flag is deprecated and will be removed")diff --git a/backend/local/local_internal_test.go b/backend/local/local_internal_test.goindex 54d9dc1fe..46493f1ee 100644--- a/backend/local/local_internal_test.go+++ b/backend/local/local_internal_test.go@@ -9,6 +9,7 @@ import ("time""github.com/ncw/rclone/fs"+ "github.com/ncw/rclone/fs/config/configmap""github.com/ncw/rclone/fs/hash""github.com/ncw/rclone/fstest""github.com/ncw/rclone/lib/file"@@ -164,3 +165,12 @@ func TestSymlink(t *testing.T) {require.Equal(t, "file.txt"[2:5+1], string(contents))require.NoError(t, in.Close())}++func TestSymlinkError(t *testing.T) {+ m := configmap.Simple{+ "links": "true",+ "copy_links": "true",+ }+ _, err := NewFs("local", "/", m)+ assert.Equal(t, errLinksAndCopyLinks, err)+}diff --git a/docs/content/local.md b/docs/content/local.mdindex 03987d138..be5e26e20 100644--- a/docs/content/local.md+++ b/docs/content/local.md@@ -81,7 +81,8 @@ Normally rclone will ignore symlinks or junction points (which behavelike symlinks under Windows).If you supply `--copy-links` or `-L` then rclone will follow the-symlink and copy the pointed to file or directory.+symlink and copy the pointed to file or directory. Note that this+flag is incompatible with `-links` / `-l`.This flag applies to all commands.@@ -121,10 +122,10 @@ $ rclone -L ls /tmp/aNormally rclone will ignore symlinks or junction points (which behavelike symlinks under Windows).-If you supply this flag then rclone will copy symblic links from the local storage,+If you supply this flag then rclone will copy symbolic links from the local storage,and store them as text files, with a '.rclonelink' suffix in the remote storage.-The text file will contain the target of the symblic link (see example).+The text file will contain the target of the symbolic link (see example).This flag applies to all commands.@@ -151,7 +152,7 @@ $ rclone ls remote:/tmp/a14 file2.rclonelink```-The remote files will contain the target of the symblic links+The remote files will contain the target of the symbolic links```$ rclone cat remote:/tmp/a/file1.rclonelink@@ -183,7 +184,10 @@ $ tree /tmp/b└── file2.rclonelink````+Note that this flag is incompatible with `-copy-links` / `-L`.+### Restricting filesystems with --one-file-system+Normally rclone will recurse through filesystems as mounted.However if you set `--one-file-system` or `-x` this tells rclone to