github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/docs/content/local.md (about)

     1  ---
     2  title: "Local Filesystem"
     3  description: "Rclone docs for the local filesystem"
     4  versionIntroduced: "v0.91"
     5  ---
     6  
     7  # {{< icon "fas fa-hdd" >}} Local Filesystem
     8  
     9  Local paths are specified as normal filesystem paths, e.g. `/path/to/wherever`, so
    10  
    11      rclone sync --interactive /home/source /tmp/destination
    12  
    13  Will sync `/home/source` to `/tmp/destination`.
    14  
    15  ## Configuration
    16  
    17  For consistencies sake one can also configure a remote of type
    18  `local` in the config file, and access the local filesystem using
    19  rclone remote paths, e.g. `remote:path/to/wherever`, but it is probably
    20  easier not to.
    21  
    22  ### Modification times
    23  
    24  Rclone reads and writes the modification times using an accuracy determined
    25  by the OS. Typically this is 1ns on Linux, 10 ns on Windows and 1 Second
    26  on OS X.
    27  
    28  ### Filenames ###
    29  
    30  Filenames should be encoded in UTF-8 on disk. This is the normal case
    31  for Windows and OS X.
    32  
    33  There is a bit more uncertainty in the Linux world, but new
    34  distributions will have UTF-8 encoded files names. If you are using an
    35  old Linux filesystem with non UTF-8 file names (e.g. latin1) then you
    36  can use the `convmv` tool to convert the filesystem to UTF-8. This
    37  tool is available in most distributions' package managers.
    38  
    39  If an invalid (non-UTF8) filename is read, the invalid characters will
    40  be replaced with a quoted representation of the invalid bytes. The name
    41  `gro\xdf` will be transferred as `gro‛DF`. `rclone` will emit a debug
    42  message in this case (use `-v` to see), e.g.
    43  
    44  ```
    45  Local file system at .: Replacing invalid UTF-8 characters in "gro\xdf"
    46  ```
    47  
    48  #### Restricted characters
    49  
    50  With the local backend, restrictions on the characters that are usable in
    51  file or directory names depend on the operating system. To check what
    52  rclone will replace by default on your system, run `rclone help flags local-encoding`.
    53  
    54  On non Windows platforms the following characters are replaced when
    55  handling file names.
    56  
    57  | Character | Value | Replacement |
    58  | --------- |:-----:|:-----------:|
    59  | NUL       | 0x00  | ␀           |
    60  | /         | 0x2F  | /           |
    61  
    62  When running on Windows the following characters are replaced. This
    63  list is based on the [Windows file naming conventions](https://docs.microsoft.com/de-de/windows/desktop/FileIO/naming-a-file#naming-conventions).
    64  
    65  | Character | Value | Replacement |
    66  | --------- |:-----:|:-----------:|
    67  | NUL       | 0x00  | ␀           |
    68  | SOH       | 0x01  | ␁           |
    69  | STX       | 0x02  | ␂           |
    70  | ETX       | 0x03  | ␃           |
    71  | EOT       | 0x04  | ␄           |
    72  | ENQ       | 0x05  | ␅           |
    73  | ACK       | 0x06  | ␆           |
    74  | BEL       | 0x07  | ␇           |
    75  | BS        | 0x08  | ␈           |
    76  | HT        | 0x09  | ␉           |
    77  | LF        | 0x0A  | ␊           |
    78  | VT        | 0x0B  | ␋           |
    79  | FF        | 0x0C  | ␌           |
    80  | CR        | 0x0D  | ␍           |
    81  | SO        | 0x0E  | ␎           |
    82  | SI        | 0x0F  | ␏           |
    83  | DLE       | 0x10  | ␐           |
    84  | DC1       | 0x11  | ␑           |
    85  | DC2       | 0x12  | ␒           |
    86  | DC3       | 0x13  | ␓           |
    87  | DC4       | 0x14  | ␔           |
    88  | NAK       | 0x15  | ␕           |
    89  | SYN       | 0x16  | ␖           |
    90  | ETB       | 0x17  | ␗           |
    91  | CAN       | 0x18  | ␘           |
    92  | EM        | 0x19  | ␙           |
    93  | SUB       | 0x1A  | ␚           |
    94  | ESC       | 0x1B  | ␛           |
    95  | FS        | 0x1C  | ␜           |
    96  | GS        | 0x1D  | ␝           |
    97  | RS        | 0x1E  | ␞           |
    98  | US        | 0x1F  | ␟           |
    99  | /         | 0x2F  | /           |
   100  | "         | 0x22  | "           |
   101  | *         | 0x2A  | *           |
   102  | :         | 0x3A  | :           |
   103  | <         | 0x3C  | <           |
   104  | >         | 0x3E  | >           |
   105  | ?         | 0x3F  | ?           |
   106  | \         | 0x5C  | \           |
   107  | \|        | 0x7C  | |           |
   108  
   109  File names on Windows can also not end with the following characters.
   110  These only get replaced if they are the last character in the name:
   111  
   112  | Character | Value | Replacement |
   113  | --------- |:-----:|:-----------:|
   114  | SP        | 0x20  | ␠           |
   115  | .         | 0x2E  | .           |
   116  
   117  Invalid UTF-8 bytes will also be [replaced](/overview/#invalid-utf8),
   118  as they can't be converted to UTF-16.
   119  
   120  ### Paths on Windows ###
   121  
   122  On Windows there are many ways of specifying a path to a file system resource.
   123  Local paths can be absolute, like `C:\path\to\wherever`, or relative,
   124  like `..\wherever`. Network paths in UNC format, `\\server\share`, are also supported.
   125  Path separator can be either `\` (as in `C:\path\to\wherever`) or `/` (as in `C:/path/to/wherever`).
   126  Length of these paths are limited to 259 characters for files and 247
   127  characters for directories, but there is an alternative extended-length
   128  path format increasing the limit to (approximately) 32,767 characters.
   129  This format requires absolute paths and the use of prefix `\\?\`,
   130  e.g. `\\?\D:\some\very\long\path`. For convenience rclone will automatically
   131  convert regular paths into the corresponding extended-length paths,
   132  so in most cases you do not have to worry about this (read more [below](#long-paths)).
   133  
   134  Note that Windows supports using the same prefix `\\?\` to
   135  specify path to volumes identified by their GUID, e.g.
   136  `\\?\Volume{b75e2c83-0000-0000-0000-602f00000000}\some\path`.
   137  This is *not* supported in rclone, due to an [issue](https://github.com/golang/go/issues/39785)
   138  in go.
   139  
   140  #### Long paths ####
   141  
   142  Rclone handles long paths automatically, by converting all paths to
   143  [extended-length path format](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation), which allows paths up to 32,767 characters.
   144  
   145  This conversion will ensure paths are absolute and prefix them with
   146  the `\\?\`. This is why you will see that your paths, for instance
   147  `.\files` is shown as path `\\?\C:\files` in the output, and `\\server\share`
   148  as `\\?\UNC\server\share`.
   149  
   150  However, in rare cases this may cause problems with buggy file
   151  system drivers like [EncFS](https://github.com/rclone/rclone/issues/261).
   152  To disable UNC conversion globally, add this to your `.rclone.conf` file:
   153  
   154  ```
   155  [local]
   156  nounc = true
   157  ```
   158  
   159  If you want to selectively disable UNC, you can add it to a separate entry like this:
   160  
   161  ```
   162  [nounc]
   163  type = local
   164  nounc = true
   165  ```
   166  And use rclone like this:
   167  
   168  `rclone copy c:\src nounc:z:\dst`
   169  
   170  This will use UNC paths on `c:\src` but not on `z:\dst`.
   171  Of course this will cause problems if the absolute path length of a
   172  file exceeds 259 characters on z, so only use this option if you have to.
   173  
   174  ### Symlinks / Junction points
   175  
   176  Normally rclone will ignore symlinks or junction points (which behave
   177  like symlinks under Windows).
   178  
   179  If you supply `--copy-links` or `-L` then rclone will follow the
   180  symlink and copy the pointed to file or directory.  Note that this
   181  flag is incompatible with `--links` / `-l`.
   182  
   183  This flag applies to all commands.
   184  
   185  For example, supposing you have a directory structure like this
   186  
   187  ```
   188  $ tree /tmp/a
   189  /tmp/a
   190  ├── b -> ../b
   191  ├── expected -> ../expected
   192  ├── one
   193  └── two
   194      └── three
   195  ```
   196  
   197  Then you can see the difference with and without the flag like this
   198  
   199  ```
   200  $ rclone ls /tmp/a
   201          6 one
   202          6 two/three
   203  ```
   204  
   205  and
   206  
   207  ```
   208  $ rclone -L ls /tmp/a
   209       4174 expected
   210          6 one
   211          6 two/three
   212          6 b/two
   213          6 b/one
   214  ```
   215  
   216  #### --links, -l 
   217  
   218  Normally rclone will ignore symlinks or junction points (which behave
   219  like symlinks under Windows).
   220  
   221  If you supply this flag then rclone will copy symbolic links from the local storage,
   222  and store them as text files, with a '.rclonelink' suffix in the remote storage.
   223  
   224  The text file will contain the target of the symbolic link (see example).
   225  
   226  This flag applies to all commands.
   227  
   228  For example, supposing you have a directory structure like this
   229  
   230  ```
   231  $ tree /tmp/a
   232  /tmp/a
   233  ├── file1 -> ./file4
   234  └── file2 -> /home/user/file3
   235  ```
   236  
   237  Copying the entire directory with '-l'
   238  
   239  ```
   240  $ rclone copy -l /tmp/a/ remote:/tmp/a/
   241  ```
   242  
   243  The remote files are created with a '.rclonelink' suffix
   244  
   245  ```
   246  $ rclone ls remote:/tmp/a
   247         5 file1.rclonelink
   248        14 file2.rclonelink
   249  ```
   250  
   251  The remote files will contain the target of the symbolic links
   252  
   253  ```
   254  $ rclone cat remote:/tmp/a/file1.rclonelink
   255  ./file4
   256  
   257  $ rclone cat remote:/tmp/a/file2.rclonelink
   258  /home/user/file3
   259  ```
   260  
   261  Copying them back with '-l'
   262  
   263  ```
   264  $ rclone copy -l remote:/tmp/a/ /tmp/b/
   265  
   266  $ tree /tmp/b
   267  /tmp/b
   268  ├── file1 -> ./file4
   269  └── file2 -> /home/user/file3
   270  ```
   271  
   272  However, if copied back without '-l'
   273  
   274  ```
   275  $ rclone copyto remote:/tmp/a/ /tmp/b/
   276  
   277  $ tree /tmp/b
   278  /tmp/b
   279  ├── file1.rclonelink
   280  └── file2.rclonelink
   281  ````
   282  
   283  If you want to copy a single file with `-l` then you must use the `.rclonelink` suffix.
   284  
   285  ```
   286  $ rclone copy -l remote:/tmp/a/file1.rclonelink /tmp/c
   287  
   288  $ tree /tmp/c
   289  /tmp/c
   290  └── file1 -> ./file4
   291  ```
   292  
   293  Note that this flag is incompatible with `-copy-links` / `-L`.
   294  
   295  ### Restricting filesystems with --one-file-system
   296  
   297  Normally rclone will recurse through filesystems as mounted.
   298  
   299  However if you set `--one-file-system` or `-x` this tells rclone to
   300  stay in the filesystem specified by the root and not to recurse into
   301  different file systems.
   302  
   303  For example if you have a directory hierarchy like this
   304  
   305  ```
   306  root
   307  ├── disk1     - disk1 mounted on the root
   308  │   └── file3 - stored on disk1
   309  ├── disk2     - disk2 mounted on the root
   310  │   └── file4 - stored on disk12
   311  ├── file1     - stored on the root disk
   312  └── file2     - stored on the root disk
   313  ```
   314  
   315  Using `rclone --one-file-system copy root remote:` will only copy `file1` and `file2`.  Eg
   316  
   317  ```
   318  $ rclone -q --one-file-system ls root
   319          0 file1
   320          0 file2
   321  ```
   322  
   323  ```
   324  $ rclone -q ls root
   325          0 disk1/file3
   326          0 disk2/file4
   327          0 file1
   328          0 file2
   329  ```
   330  
   331  **NB** Rclone (like most unix tools such as `du`, `rsync` and `tar`)
   332  treats a bind mount to the same device as being on the same
   333  filesystem.
   334  
   335  **NB** This flag is only available on Unix based systems.  On systems
   336  where it isn't supported (e.g. Windows) it will be ignored.
   337  
   338  {{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/local/local.go then run make backenddocs" >}}
   339  ### Advanced options
   340  
   341  Here are the Advanced options specific to local (Local Disk).
   342  
   343  #### --local-nounc
   344  
   345  Disable UNC (long path names) conversion on Windows.
   346  
   347  Properties:
   348  
   349  - Config:      nounc
   350  - Env Var:     RCLONE_LOCAL_NOUNC
   351  - Type:        bool
   352  - Default:     false
   353  - Examples:
   354      - "true"
   355          - Disables long file names.
   356  
   357  #### --copy-links / -L
   358  
   359  Follow symlinks and copy the pointed to item.
   360  
   361  Properties:
   362  
   363  - Config:      copy_links
   364  - Env Var:     RCLONE_LOCAL_COPY_LINKS
   365  - Type:        bool
   366  - Default:     false
   367  
   368  #### --links / -l
   369  
   370  Translate symlinks to/from regular files with a '.rclonelink' extension.
   371  
   372  Properties:
   373  
   374  - Config:      links
   375  - Env Var:     RCLONE_LOCAL_LINKS
   376  - Type:        bool
   377  - Default:     false
   378  
   379  #### --skip-links
   380  
   381  Don't warn about skipped symlinks.
   382  
   383  This flag disables warning messages on skipped symlinks or junction
   384  points, as you explicitly acknowledge that they should be skipped.
   385  
   386  Properties:
   387  
   388  - Config:      skip_links
   389  - Env Var:     RCLONE_LOCAL_SKIP_LINKS
   390  - Type:        bool
   391  - Default:     false
   392  
   393  #### --local-zero-size-links
   394  
   395  Assume the Stat size of links is zero (and read them instead) (deprecated).
   396  
   397  Rclone used to use the Stat size of links as the link size, but this fails in quite a few places:
   398  
   399  - Windows
   400  - On some virtual filesystems (such ash LucidLink)
   401  - Android
   402  
   403  So rclone now always reads the link.
   404  
   405  
   406  Properties:
   407  
   408  - Config:      zero_size_links
   409  - Env Var:     RCLONE_LOCAL_ZERO_SIZE_LINKS
   410  - Type:        bool
   411  - Default:     false
   412  
   413  #### --local-unicode-normalization
   414  
   415  Apply unicode NFC normalization to paths and filenames.
   416  
   417  This flag can be used to normalize file names into unicode NFC form
   418  that are read from the local filesystem.
   419  
   420  Rclone does not normally touch the encoding of file names it reads from
   421  the file system.
   422  
   423  This can be useful when using macOS as it normally provides decomposed (NFD)
   424  unicode which in some language (eg Korean) doesn't display properly on
   425  some OSes.
   426  
   427  Note that rclone compares filenames with unicode normalization in the sync
   428  routine so this flag shouldn't normally be used.
   429  
   430  Properties:
   431  
   432  - Config:      unicode_normalization
   433  - Env Var:     RCLONE_LOCAL_UNICODE_NORMALIZATION
   434  - Type:        bool
   435  - Default:     false
   436  
   437  #### --local-no-check-updated
   438  
   439  Don't check to see if the files change during upload.
   440  
   441  Normally rclone checks the size and modification time of files as they
   442  are being uploaded and aborts with a message which starts "can't copy -
   443  source file is being updated" if the file changes during upload.
   444  
   445  However on some file systems this modification time check may fail (e.g.
   446  [Glusterfs #2206](https://github.com/rclone/rclone/issues/2206)) so this
   447  check can be disabled with this flag.
   448  
   449  If this flag is set, rclone will use its best efforts to transfer a
   450  file which is being updated. If the file is only having things
   451  appended to it (e.g. a log) then rclone will transfer the log file with
   452  the size it had the first time rclone saw it.
   453  
   454  If the file is being modified throughout (not just appended to) then
   455  the transfer may fail with a hash check failure.
   456  
   457  In detail, once the file has had stat() called on it for the first
   458  time we:
   459  
   460  - Only transfer the size that stat gave
   461  - Only checksum the size that stat gave
   462  - Don't update the stat info for the file
   463  
   464  **NB** do not use this flag on a Windows Volume Shadow (VSS). For some
   465  unknown reason, files in a VSS sometimes show different sizes from the
   466  directory listing (where the initial stat value comes from on Windows)
   467  and when stat is called on them directly. Other copy tools always use
   468  the direct stat value and setting this flag will disable that.
   469  
   470  
   471  Properties:
   472  
   473  - Config:      no_check_updated
   474  - Env Var:     RCLONE_LOCAL_NO_CHECK_UPDATED
   475  - Type:        bool
   476  - Default:     false
   477  
   478  #### --one-file-system / -x
   479  
   480  Don't cross filesystem boundaries (unix/macOS only).
   481  
   482  Properties:
   483  
   484  - Config:      one_file_system
   485  - Env Var:     RCLONE_LOCAL_ONE_FILE_SYSTEM
   486  - Type:        bool
   487  - Default:     false
   488  
   489  #### --local-case-sensitive
   490  
   491  Force the filesystem to report itself as case sensitive.
   492  
   493  Normally the local backend declares itself as case insensitive on
   494  Windows/macOS and case sensitive for everything else.  Use this flag
   495  to override the default choice.
   496  
   497  Properties:
   498  
   499  - Config:      case_sensitive
   500  - Env Var:     RCLONE_LOCAL_CASE_SENSITIVE
   501  - Type:        bool
   502  - Default:     false
   503  
   504  #### --local-case-insensitive
   505  
   506  Force the filesystem to report itself as case insensitive.
   507  
   508  Normally the local backend declares itself as case insensitive on
   509  Windows/macOS and case sensitive for everything else.  Use this flag
   510  to override the default choice.
   511  
   512  Properties:
   513  
   514  - Config:      case_insensitive
   515  - Env Var:     RCLONE_LOCAL_CASE_INSENSITIVE
   516  - Type:        bool
   517  - Default:     false
   518  
   519  #### --local-no-preallocate
   520  
   521  Disable preallocation of disk space for transferred files.
   522  
   523  Preallocation of disk space helps prevent filesystem fragmentation.
   524  However, some virtual filesystem layers (such as Google Drive File
   525  Stream) may incorrectly set the actual file size equal to the
   526  preallocated space, causing checksum and file size checks to fail.
   527  Use this flag to disable preallocation.
   528  
   529  Properties:
   530  
   531  - Config:      no_preallocate
   532  - Env Var:     RCLONE_LOCAL_NO_PREALLOCATE
   533  - Type:        bool
   534  - Default:     false
   535  
   536  #### --local-no-sparse
   537  
   538  Disable sparse files for multi-thread downloads.
   539  
   540  On Windows platforms rclone will make sparse files when doing
   541  multi-thread downloads. This avoids long pauses on large files where
   542  the OS zeros the file. However sparse files may be undesirable as they
   543  cause disk fragmentation and can be slow to work with.
   544  
   545  Properties:
   546  
   547  - Config:      no_sparse
   548  - Env Var:     RCLONE_LOCAL_NO_SPARSE
   549  - Type:        bool
   550  - Default:     false
   551  
   552  #### --local-no-set-modtime
   553  
   554  Disable setting modtime.
   555  
   556  Normally rclone updates modification time of files after they are done
   557  uploading. This can cause permissions issues on Linux platforms when 
   558  the user rclone is running as does not own the file uploaded, such as
   559  when copying to a CIFS mount owned by another user. If this option is 
   560  enabled, rclone will no longer update the modtime after copying a file.
   561  
   562  Properties:
   563  
   564  - Config:      no_set_modtime
   565  - Env Var:     RCLONE_LOCAL_NO_SET_MODTIME
   566  - Type:        bool
   567  - Default:     false
   568  
   569  #### --local-encoding
   570  
   571  The encoding for the backend.
   572  
   573  See the [encoding section in the overview](/overview/#encoding) for more info.
   574  
   575  Properties:
   576  
   577  - Config:      encoding
   578  - Env Var:     RCLONE_LOCAL_ENCODING
   579  - Type:        Encoding
   580  - Default:     Slash,Dot
   581  
   582  #### --local-description
   583  
   584  Description of the remote
   585  
   586  Properties:
   587  
   588  - Config:      description
   589  - Env Var:     RCLONE_LOCAL_DESCRIPTION
   590  - Type:        string
   591  - Required:    false
   592  
   593  ### Metadata
   594  
   595  Depending on which OS is in use the local backend may return only some
   596  of the system metadata. Setting system metadata is supported on all
   597  OSes but setting user metadata is only supported on linux, freebsd,
   598  netbsd, macOS and Solaris. It is **not** supported on Windows yet
   599  ([see pkg/attrs#47](https://github.com/pkg/xattr/issues/47)).
   600  
   601  User metadata is stored as extended attributes (which may not be
   602  supported by all file systems) under the "user.*" prefix.
   603  
   604  Metadata is supported on files and directories.
   605  
   606  Here are the possible system metadata items for the local backend.
   607  
   608  | Name | Help | Type | Example | Read Only |
   609  |------|------|------|---------|-----------|
   610  | atime | Time of last access | RFC 3339 | 2006-01-02T15:04:05.999999999Z07:00 | N |
   611  | btime | Time of file birth (creation) | RFC 3339 | 2006-01-02T15:04:05.999999999Z07:00 | N |
   612  | gid | Group ID of owner | decimal number | 500 | N |
   613  | mode | File type and mode | octal, unix style | 0100664 | N |
   614  | mtime | Time of last modification | RFC 3339 | 2006-01-02T15:04:05.999999999Z07:00 | N |
   615  | rdev | Device ID (if special file) | hexadecimal | 1abc | N |
   616  | uid | User ID of owner | decimal number | 500 | N |
   617  
   618  See the [metadata](/docs/#metadata) docs for more info.
   619  
   620  ## Backend commands
   621  
   622  Here are the commands specific to the local backend.
   623  
   624  Run them with
   625  
   626      rclone backend COMMAND remote:
   627  
   628  The help below will explain what arguments each command takes.
   629  
   630  See the [backend](/commands/rclone_backend/) command for more
   631  info on how to pass options and arguments.
   632  
   633  These can be run on a running backend using the rc command
   634  [backend/command](/rc/#backend-command).
   635  
   636  ### noop
   637  
   638  A null operation for testing backend commands
   639  
   640      rclone backend noop remote: [options] [<arguments>+]
   641  
   642  This is a test command which has some options
   643  you can try to change the output.
   644  
   645  Options:
   646  
   647  - "echo": echo the input arguments
   648  - "error": return an error based on option value
   649  
   650  {{< rem autogenerated options stop >}}