Compare commits
77
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f5ee5d81f | ||
|
|
8b41dfa50a | ||
|
|
0d8bcc08da | ||
|
|
d3b7f14b66 | ||
|
|
f66928a846 | ||
|
|
3b1122c888 | ||
|
|
463a18aa07 | ||
|
|
0a932dc1f2 | ||
|
|
8856e0e559 | ||
|
|
3b6df71838 | ||
|
|
31de631b22 | ||
|
|
189ef5f257 | ||
|
|
2f67681e3b | ||
|
|
41127965b0 | ||
|
|
8171671d82 | ||
|
|
75617c0c3b | ||
|
|
8b9d23916b | ||
|
|
e43b79e33d | ||
|
|
459cc70a50 | ||
|
|
20578f3f89 | ||
|
|
15da53696e | ||
|
|
2bddba118e | ||
|
|
c7e5976e11 | ||
|
|
f0bf9cfda1 | ||
|
|
671dd047f7 | ||
|
|
6272ca74bc | ||
|
|
f5af761466 | ||
|
|
06f1c0c61c | ||
|
|
e6a9f005d6 | ||
|
|
8f6f4b053c | ||
|
|
fe15a2eeeb | ||
|
|
019667170f | ||
|
|
7a496752f3 | ||
|
|
b569dc11a0 | ||
|
|
df4e6079f1 | ||
|
|
6156f90601 | ||
|
|
cdaea62932 | ||
|
|
78afe01d15 | ||
|
|
4eac88babf | ||
|
|
b4217fabd3 | ||
|
|
92b9dabf3c | ||
|
|
4323ff8a63 | ||
|
|
3e188495f5 | ||
|
|
acb9e17eb3 | ||
|
|
c8ab4f1d02 | ||
|
|
e776a1b122 | ||
|
|
c57af26de9 | ||
|
|
7d89912666 | ||
|
|
cd075f1703 | ||
|
|
35b2ca642c | ||
|
|
127f48e8ad | ||
|
|
3e986cdf54 | ||
|
|
b80d498304 | ||
|
|
757e696a6b | ||
|
|
e3979131f2 | ||
|
|
a774f6bfdb | ||
|
|
d7cd35e2ca | ||
|
|
38e70f1797 | ||
|
|
3b49440c25 | ||
|
|
7c0287b824 | ||
|
|
f97c2c85bd | ||
|
|
14c0d8a93e | ||
|
|
768ad4de2a | ||
|
|
817987dfc4 | ||
|
|
eb090d3544 | ||
|
|
4daf8b7083 | ||
|
|
0be69018b8 | ||
|
|
9b9ab5f3e8 | ||
|
|
072464cbdb | ||
|
|
b0491dec88 | ||
|
|
ccfefedb47 | ||
|
|
2fffcf9e7f | ||
|
|
a39a5d261c | ||
|
|
45b57822d5 | ||
|
|
d8984cd37f | ||
|
|
80e63af470 | ||
|
|
db2c38b21b |
No files matched your search
@@ -87,7 +87,7 @@ jobs:
|
||||
|
||||
- job_name: go1.16
|
||||
os: ubuntu-latest
|
||||
go: '1.16.0-beta1'
|
||||
go: '1.16.0-rc1'
|
||||
quicktest: true
|
||||
racequicktest: true
|
||||
|
||||
|
||||
Generated
+11758
-8738
File diff suppressed because it is too large.
Load diff
Generated
+12409
-8623
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
||||
// Package azureblob provides an interface to the Microsoft Azure blob object storage system
|
||||
|
||||
// +build !plan9,!solaris,!js,go1.13
|
||||
// +build !plan9,!solaris,!js,go1.14
|
||||
|
||||
package azureblob
|
||||
|
||||
@@ -49,6 +49,7 @@ const (
|
||||
storageDefaultBaseURL = "blob.core.windows.net"
|
||||
defaultChunkSize = 4 * fs.MebiByte
|
||||
maxChunkSize = 100 * fs.MebiByte
|
||||
uploadConcurrency = 4
|
||||
defaultAccessTier = azblob.AccessTierNone
|
||||
maxTryTimeout = time.Hour * 24 * 365 //max time of an azure web request response window (whether or not data is flowing)
|
||||
// Default storage account, key and blob endpoint for emulator support,
|
||||
@@ -1492,6 +1493,48 @@ func increment(xs []byte) {
|
||||
}
|
||||
}
|
||||
|
||||
// poolWrapper wraps a pool.Pool as an azblob.TransferManager
|
||||
type poolWrapper struct {
|
||||
pool *pool.Pool
|
||||
bufToken chan struct{}
|
||||
runToken chan struct{}
|
||||
}
|
||||
|
||||
// newPoolWrapper creates an azblob.TransferManager that will use a
|
||||
// pool.Pool with maximum concurrency as specified.
|
||||
func (f *Fs) newPoolWrapper(concurrency int) azblob.TransferManager {
|
||||
return &poolWrapper{
|
||||
pool: f.pool,
|
||||
bufToken: make(chan struct{}, concurrency),
|
||||
runToken: make(chan struct{}, concurrency),
|
||||
}
|
||||
}
|
||||
|
||||
// Get implements TransferManager.Get().
|
||||
func (pw *poolWrapper) Get() []byte {
|
||||
pw.bufToken <- struct{}{}
|
||||
return pw.pool.Get()
|
||||
}
|
||||
|
||||
// Put implements TransferManager.Put().
|
||||
func (pw *poolWrapper) Put(b []byte) {
|
||||
pw.pool.Put(b)
|
||||
<-pw.bufToken
|
||||
}
|
||||
|
||||
// Run implements TransferManager.Run().
|
||||
func (pw *poolWrapper) Run(f func()) {
|
||||
pw.runToken <- struct{}{}
|
||||
go func() {
|
||||
f()
|
||||
<-pw.runToken
|
||||
}()
|
||||
}
|
||||
|
||||
// Close implements TransferManager.Close().
|
||||
func (pw *poolWrapper) Close() {
|
||||
}
|
||||
|
||||
// Update the object with the contents of the io.Reader, modTime and size
|
||||
//
|
||||
// The new object may have been created if an error is returned
|
||||
@@ -1538,9 +1581,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
|
||||
putBlobOptions := azblob.UploadStreamToBlockBlobOptions{
|
||||
BufferSize: int(o.fs.opt.ChunkSize),
|
||||
MaxBuffers: 4,
|
||||
MaxBuffers: uploadConcurrency,
|
||||
Metadata: o.meta,
|
||||
BlobHTTPHeaders: httpHeaders,
|
||||
TransferManager: o.fs.newPoolWrapper(uploadConcurrency),
|
||||
}
|
||||
|
||||
// Don't retry, return a retry error instead
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build !plan9,!solaris,!js,go1.13
|
||||
// +build !plan9,!solaris,!js,go1.14
|
||||
|
||||
package azureblob
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Test AzureBlob filesystem interface
|
||||
|
||||
// +build !plan9,!solaris,!js,go1.13
|
||||
// +build !plan9,!solaris,!js,go1.14
|
||||
|
||||
package azureblob
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Build for azureblob for unsupported platforms to stop go complaining
|
||||
// about "no buildable Go source files "
|
||||
|
||||
// +build plan9 solaris js !go1.13
|
||||
// +build plan9 solaris js !go1.14
|
||||
|
||||
package azureblob
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build !plan9,!solaris,!js,go1.13
|
||||
// +build !plan9,!solaris,!js,go1.14
|
||||
|
||||
package azureblob
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// +build !plan9,!solaris,!js,go1.13
|
||||
// +build !plan9,!solaris,!js,go1.14
|
||||
|
||||
package azureblob
|
||||
|
||||
|
||||
+1
-1
@@ -708,7 +708,7 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuck
|
||||
remote := file.Name[len(prefix):]
|
||||
// Check for directory
|
||||
isDirectory := remote == "" || strings.HasSuffix(remote, "/")
|
||||
if isDirectory {
|
||||
if isDirectory && len(remote) > 1 {
|
||||
remote = remote[:len(remote)-1]
|
||||
}
|
||||
if addBucket {
|
||||
|
||||
+1
-1
@@ -514,7 +514,7 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
|
||||
func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error) {
|
||||
// Find the leaf in pathID
|
||||
found, err = f.listAll(ctx, pathID, true, false, func(item *api.Item) bool {
|
||||
if item.Name == leaf {
|
||||
if strings.EqualFold(item.Name, leaf) {
|
||||
pathIDOut = item.ID
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -27,6 +29,7 @@ import (
|
||||
"github.com/rclone/rclone/fs/config/configstruct"
|
||||
"github.com/rclone/rclone/fs/fspath"
|
||||
"github.com/rclone/rclone/fs/hash"
|
||||
"github.com/rclone/rclone/fs/object"
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
)
|
||||
|
||||
@@ -89,15 +92,26 @@ func init() {
|
||||
Level 0 turns off compression.`,
|
||||
Default: sgzip.DefaultCompression,
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "ram_cache_limit",
|
||||
Help: `Some remotes don't allow the upload of files with unknown size.
|
||||
In this case the compressed file will need to be cached to determine
|
||||
it's size.
|
||||
|
||||
Files smaller than this limit will be cached in RAM, file larger than
|
||||
this limit will be cached on disk`,
|
||||
Default: fs.SizeSuffix(20 * 1024 * 1024),
|
||||
Advanced: true,
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
||||
// Options defines the configuration for this backend
|
||||
type Options struct {
|
||||
Remote string `config:"remote"`
|
||||
CompressionMode string `config:"mode"`
|
||||
CompressionLevel int `config:"level"`
|
||||
Remote string `config:"remote"`
|
||||
CompressionMode string `config:"mode"`
|
||||
CompressionLevel int `config:"level"`
|
||||
RAMCacheLimit fs.SizeSuffix `config:"ram_cache_limit"`
|
||||
}
|
||||
|
||||
/*** FILESYSTEM FUNCTIONS ***/
|
||||
@@ -416,8 +430,55 @@ type compressionResult struct {
|
||||
meta sgzip.GzipMetadata
|
||||
}
|
||||
|
||||
// replicating some of operations.Rcat functionality because we want to support remotes without streaming
|
||||
// support and of course cannot know the size of a compressed file before compressing it.
|
||||
func (f *Fs) rcat(ctx context.Context, dstFileName string, in io.ReadCloser, modTime time.Time, options []fs.OpenOption) (o fs.Object, err error) {
|
||||
|
||||
// cache small files in memory and do normal upload
|
||||
buf := make([]byte, f.opt.RAMCacheLimit)
|
||||
if n, err := io.ReadFull(in, buf); err == io.EOF || err == io.ErrUnexpectedEOF {
|
||||
src := object.NewStaticObjectInfo(dstFileName, modTime, int64(len(buf[:n])), false, nil, f.Fs)
|
||||
return f.Fs.Put(ctx, bytes.NewBuffer(buf[:n]), src, options...)
|
||||
}
|
||||
|
||||
// Need to include what we allready read
|
||||
in = &ReadCloserWrapper{
|
||||
Reader: io.MultiReader(bytes.NewReader(buf), in),
|
||||
Closer: in,
|
||||
}
|
||||
|
||||
canStream := f.Fs.Features().PutStream != nil
|
||||
if canStream {
|
||||
src := object.NewStaticObjectInfo(dstFileName, modTime, -1, false, nil, f.Fs)
|
||||
return f.Fs.Features().PutStream(ctx, in, src, options...)
|
||||
}
|
||||
|
||||
fs.Debugf(f, "Target remote doesn't support streaming uploads, creating temporary local file")
|
||||
tempFile, err := ioutil.TempFile("", "rclone-press-")
|
||||
defer func() {
|
||||
// these errors should be relatively uncritical and the upload should've succeeded so it's okay-ish
|
||||
// to ignore them
|
||||
_ = tempFile.Close()
|
||||
_ = os.Remove(tempFile.Name())
|
||||
}()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Failed to create temporary local FS to spool file")
|
||||
}
|
||||
if _, err = io.Copy(tempFile, in); err != nil {
|
||||
return nil, errors.Wrap(err, "Failed to write temporary local file")
|
||||
}
|
||||
if _, err = tempFile.Seek(0, 0); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finfo, err := tempFile.Stat()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f.Fs.Put(ctx, tempFile, object.NewStaticObjectInfo(dstFileName, modTime, finfo.Size(), false, nil, f.Fs))
|
||||
}
|
||||
|
||||
// Put a compressed version of a file. Returns a wrappable object and metadata.
|
||||
func (f *Fs) putCompress(ctx context.Context, in io.Reader, src fs.ObjectInfo, options []fs.OpenOption, put putFn, mimeType string) (fs.Object, *ObjectMetadata, error) {
|
||||
func (f *Fs) putCompress(ctx context.Context, in io.Reader, src fs.ObjectInfo, options []fs.OpenOption, mimeType string) (fs.Object, *ObjectMetadata, error) {
|
||||
// Unwrap reader accounting
|
||||
in, wrap := accounting.UnWrap(in)
|
||||
|
||||
@@ -471,7 +532,7 @@ func (f *Fs) putCompress(ctx context.Context, in io.Reader, src fs.ObjectInfo, o
|
||||
}
|
||||
|
||||
// Transfer the data
|
||||
o, err := put(ctx, wrappedIn, f.wrapInfo(src, makeDataName(src.Remote(), src.Size(), f.mode), src.Size()), options...)
|
||||
o, err := f.rcat(ctx, makeDataName(src.Remote(), src.Size(), f.mode), ioutil.NopCloser(wrappedIn), src.ModTime(ctx), options)
|
||||
//o, err := operations.Rcat(ctx, f.Fs, makeDataName(src.Remote(), src.Size(), f.mode), ioutil.NopCloser(wrappedIn), src.ModTime(ctx))
|
||||
if err != nil {
|
||||
if o != nil {
|
||||
@@ -510,7 +571,7 @@ func (f *Fs) putCompress(ctx context.Context, in io.Reader, src fs.ObjectInfo, o
|
||||
}
|
||||
|
||||
// Put an uncompressed version of a file. Returns a wrappable object and metadata.
|
||||
func (f *Fs) putUncompress(ctx context.Context, in io.Reader, src fs.ObjectInfo, options []fs.OpenOption, put putFn, mimeType string) (fs.Object, *ObjectMetadata, error) {
|
||||
func (f *Fs) putUncompress(ctx context.Context, in io.Reader, src fs.ObjectInfo, put putFn, options []fs.OpenOption, mimeType string) (fs.Object, *ObjectMetadata, error) {
|
||||
// Unwrap the accounting, add our metadata hasher, then wrap it back on
|
||||
in, wrap := accounting.UnWrap(in)
|
||||
|
||||
@@ -577,6 +638,8 @@ func (f *Fs) putMetadata(ctx context.Context, meta *ObjectMetadata, src fs.Objec
|
||||
|
||||
// This function will put both the data and metadata for an Object.
|
||||
// putData is the function used for data, while putMeta is the function used for metadata.
|
||||
// The putData function will only be used when the object is not compressible if the
|
||||
// data is compressible this parameter will be ignored.
|
||||
func (f *Fs) putWithCustomFunctions(ctx context.Context, in io.Reader, src fs.ObjectInfo, options []fs.OpenOption,
|
||||
putData putFn, putMeta putFn, compressible bool, mimeType string) (*Object, error) {
|
||||
// Put file then metadata
|
||||
@@ -584,9 +647,9 @@ func (f *Fs) putWithCustomFunctions(ctx context.Context, in io.Reader, src fs.Ob
|
||||
var meta *ObjectMetadata
|
||||
var err error
|
||||
if compressible {
|
||||
dataObject, meta, err = f.putCompress(ctx, in, src, options, putData, mimeType)
|
||||
dataObject, meta, err = f.putCompress(ctx, in, src, options, mimeType)
|
||||
} else {
|
||||
dataObject, meta, err = f.putUncompress(ctx, in, src, options, putData, mimeType)
|
||||
dataObject, meta, err = f.putUncompress(ctx, in, src, putData, options, mimeType)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -837,7 +900,7 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
|
||||
func (f *Fs) CleanUp(ctx context.Context) error {
|
||||
do := f.Fs.Features().CleanUp
|
||||
if do == nil {
|
||||
return errors.New("can't CleanUp")
|
||||
return errors.New("can't CleanUp: not supported by underlying remote")
|
||||
}
|
||||
return do(ctx)
|
||||
}
|
||||
@@ -846,7 +909,7 @@ func (f *Fs) CleanUp(ctx context.Context) error {
|
||||
func (f *Fs) About(ctx context.Context) (*fs.Usage, error) {
|
||||
do := f.Fs.Features().About
|
||||
if do == nil {
|
||||
return nil, errors.New("About not supported")
|
||||
return nil, errors.New("can't About: not supported by underlying remote")
|
||||
}
|
||||
return do(ctx)
|
||||
}
|
||||
@@ -922,7 +985,7 @@ func (f *Fs) ChangeNotify(ctx context.Context, notifyFunc func(string, fs.EntryT
|
||||
func (f *Fs) PublicLink(ctx context.Context, remote string, duration fs.Duration, unlink bool) (string, error) {
|
||||
do := f.Fs.Features().PublicLink
|
||||
if do == nil {
|
||||
return "", errors.New("PublicLink not supported")
|
||||
return "", errors.New("can't PublicLink: not supported by underlying remote")
|
||||
}
|
||||
o, err := f.NewObject(ctx, remote)
|
||||
if err != nil {
|
||||
@@ -1033,7 +1096,8 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Function that updates object
|
||||
// We can only support update when BOTH the old and the new object are uncompressed because only then
|
||||
// the filesize will be known beforehand and name will stay the same
|
||||
update := func(ctx context.Context, in io.Reader, src fs.ObjectInfo, options ...fs.OpenOption) (fs.Object, error) {
|
||||
return o.Object, o.Object.Update(ctx, in, src, options...)
|
||||
}
|
||||
@@ -1121,7 +1185,7 @@ func (o *Object) String() string {
|
||||
func (o *Object) Remote() string {
|
||||
origFileName, _, _, err := processFileName(o.Object.Remote())
|
||||
if err != nil {
|
||||
fs.Errorf(o, "Could not get remote path for: %s", o.Object.Remote())
|
||||
fs.Errorf(o.f, "Could not get remote path for: %s", o.Object.Remote())
|
||||
return o.Object.Remote()
|
||||
}
|
||||
return origFileName
|
||||
@@ -1161,15 +1225,19 @@ func (o *Object) Hash(ctx context.Context, ht hash.Type) (string, error) {
|
||||
// multiple storage classes supported
|
||||
func (o *Object) SetTier(tier string) error {
|
||||
do, ok := o.Object.(fs.SetTierer)
|
||||
if !ok {
|
||||
mdo, mok := o.mo.(fs.SetTierer)
|
||||
if !(ok && mok) {
|
||||
return errors.New("press: underlying remote does not support SetTier")
|
||||
}
|
||||
if err := mdo.SetTier(tier); err != nil {
|
||||
return err
|
||||
}
|
||||
return do.SetTier(tier)
|
||||
}
|
||||
|
||||
// GetTier returns storage tier or class of the Object
|
||||
func (o *Object) GetTier() string {
|
||||
do, ok := o.Object.(fs.GetTierer)
|
||||
do, ok := o.mo.(fs.GetTierer)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
@@ -1272,10 +1340,7 @@ func (o *ObjectInfo) Remote() string {
|
||||
|
||||
// Size returns the size of the file
|
||||
func (o *ObjectInfo) Size() int64 {
|
||||
if o.size != -1 {
|
||||
return o.size
|
||||
}
|
||||
return o.src.Size()
|
||||
return o.size
|
||||
}
|
||||
|
||||
// ModTime returns the modification time
|
||||
@@ -1286,14 +1351,7 @@ func (o *ObjectInfo) ModTime(ctx context.Context) time.Time {
|
||||
// Hash returns the selected checksum of the file
|
||||
// If no checksum is available it returns ""
|
||||
func (o *ObjectInfo) Hash(ctx context.Context, ht hash.Type) (string, error) {
|
||||
if ht != hash.MD5 {
|
||||
return "", hash.ErrUnsupported
|
||||
}
|
||||
value, err := o.src.Hash(ctx, ht)
|
||||
if err == hash.ErrUnsupported {
|
||||
return "", hash.ErrUnsupported
|
||||
}
|
||||
return value, err
|
||||
return "", nil // cannot know the checksum
|
||||
}
|
||||
|
||||
// ID returns the ID of the Object if known, or "" if not
|
||||
|
||||
@@ -6,18 +6,17 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
_ "github.com/rclone/rclone/backend/dropbox"
|
||||
_ "github.com/rclone/rclone/backend/drive"
|
||||
_ "github.com/rclone/rclone/backend/local"
|
||||
_ "github.com/rclone/rclone/backend/s3"
|
||||
_ "github.com/rclone/rclone/backend/swift"
|
||||
"github.com/rclone/rclone/fstest"
|
||||
"github.com/rclone/rclone/fstest/fstests"
|
||||
)
|
||||
|
||||
// TestIntegration runs integration tests against the remote
|
||||
func TestIntegration(t *testing.T) {
|
||||
if *fstest.RemoteName == "" {
|
||||
t.Skip("Skipping as -remote not set")
|
||||
}
|
||||
fstests.Run(t, &fstests.Opt{
|
||||
opt := fstests.Opt{
|
||||
RemoteName: *fstest.RemoteName,
|
||||
NilObject: (*Object)(nil),
|
||||
UnimplementableFsMethods: []string{
|
||||
@@ -29,11 +28,9 @@ func TestIntegration(t *testing.T) {
|
||||
"UserInfo",
|
||||
"Disconnect",
|
||||
},
|
||||
UnimplementableObjectMethods: []string{
|
||||
"GetTier",
|
||||
"SetTier",
|
||||
},
|
||||
})
|
||||
TiersToTest: []string{"STANDARD", "STANDARD_IA"},
|
||||
UnimplementableObjectMethods: []string{}}
|
||||
fstests.Run(t, &opt)
|
||||
}
|
||||
|
||||
// TestRemoteGzip tests GZIP compression
|
||||
|
||||
+18
-3
@@ -73,6 +73,7 @@ const (
|
||||
partialFields = "id,name,size,md5Checksum,trashed,explicitlyTrashed,modifiedTime,createdTime,mimeType,parents,webViewLink,shortcutDetails,exportLinks"
|
||||
listRGrouping = 50 // number of IDs to search at once when using ListR
|
||||
listRInputBuffer = 1000 // size of input buffer when using ListR
|
||||
defaultXDGIcon = "text-html"
|
||||
)
|
||||
|
||||
// Globals
|
||||
@@ -128,6 +129,12 @@ var (
|
||||
_mimeTypeCustomTransform = map[string]string{
|
||||
"application/vnd.google-apps.script+json": "application/json",
|
||||
}
|
||||
_mimeTypeToXDGLinkIcons = map[string]string{
|
||||
"application/vnd.google-apps.document": "x-office-document",
|
||||
"application/vnd.google-apps.drawing": "x-office-drawing",
|
||||
"application/vnd.google-apps.presentation": "x-office-presentation",
|
||||
"application/vnd.google-apps.spreadsheet": "x-office-spreadsheet",
|
||||
}
|
||||
fetchFormatsOnce sync.Once // make sure we fetch the export/import formats only once
|
||||
_exportFormats map[string][]string // allowed export MIME type conversions
|
||||
_importFormats map[string][]string // allowed import MIME type conversions
|
||||
@@ -1294,11 +1301,15 @@ func (f *Fs) newLinkObject(remote string, info *drive.File, extension, exportMim
|
||||
if t == nil {
|
||||
return nil, errors.Errorf("unsupported link type %s", exportMimeType)
|
||||
}
|
||||
xdgIcon := _mimeTypeToXDGLinkIcons[info.MimeType]
|
||||
if xdgIcon == "" {
|
||||
xdgIcon = defaultXDGIcon
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
err := t.Execute(&buf, struct {
|
||||
URL, Title string
|
||||
URL, Title, XDGIcon string
|
||||
}{
|
||||
info.WebViewLink, info.Name,
|
||||
info.WebViewLink, info.Name, xdgIcon,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "executing template failed")
|
||||
@@ -2449,6 +2460,7 @@ func (f *Fs) CleanUp(ctx context.Context) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fs.Logf(f, "Note that emptying the trash happens in the background and can take some time.")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3052,6 +3064,9 @@ func (f *Fs) copyID(ctx context.Context, id, dest string) (err error) {
|
||||
if destLeaf == "" {
|
||||
destLeaf = info.Name
|
||||
}
|
||||
if destDir == "" {
|
||||
destDir = "."
|
||||
}
|
||||
dstFs, err := cache.Get(ctx, destDir)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -3749,7 +3764,7 @@ URL={{ .URL }}{{"\r"}}
|
||||
Encoding=UTF-8
|
||||
Name={{ .Title }}
|
||||
URL={{ .URL }}
|
||||
Icon=text-html
|
||||
Icon={{ .XDGIcon }}
|
||||
Type=Link
|
||||
`
|
||||
htmlTemplate = `<html>
|
||||
|
||||
@@ -536,7 +536,7 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
|
||||
func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error) {
|
||||
// Find the leaf in pathID
|
||||
found, err = f.listAll(ctx, pathID, true, false, func(item *api.Item) bool {
|
||||
if item.Name == leaf {
|
||||
if strings.EqualFold(item.Name, leaf) {
|
||||
pathIDOut = item.ID
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
opt.ServiceAccountCredentials = string(loadedCreds)
|
||||
}
|
||||
if opt.Anonymous {
|
||||
oAuthClient = &http.Client{}
|
||||
oAuthClient = fshttp.NewClient(ctx)
|
||||
} else if opt.ServiceAccountCredentials != "" {
|
||||
oAuthClient, err = getServiceAccountClient(ctx, []byte(opt.ServiceAccountCredentials))
|
||||
if err != nil {
|
||||
@@ -564,7 +564,7 @@ func (f *Fs) list(ctx context.Context, bucket, directory, prefix string, addBuck
|
||||
remote = path.Join(bucket, remote)
|
||||
}
|
||||
// is this a directory marker?
|
||||
if isDirectory && object.Size == 0 {
|
||||
if isDirectory {
|
||||
continue // skip directory marker
|
||||
}
|
||||
err = fn(remote, object, false)
|
||||
|
||||
@@ -132,15 +132,33 @@ you want to read the media.`,
|
||||
Default: 2000,
|
||||
Help: `Year limits the photos to be downloaded to those which are uploaded after the given year`,
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "include_archived",
|
||||
Default: false,
|
||||
Help: `Also view and download archived media.
|
||||
|
||||
By default rclone does not request archived media. Thus, when syncing,
|
||||
archived media is not visible in directory listings or transferred.
|
||||
|
||||
Note that media in albums is always visible and synced, no matter
|
||||
their archive status.
|
||||
|
||||
With this flag, archived media are always visible in directory
|
||||
listings and transferred.
|
||||
|
||||
Without this flag, archived media will not be visible in directory
|
||||
listings and won't be transferred.`,
|
||||
Advanced: true,
|
||||
}}...),
|
||||
})
|
||||
}
|
||||
|
||||
// Options defines the configuration for this backend
|
||||
type Options struct {
|
||||
ReadOnly bool `config:"read_only"`
|
||||
ReadSize bool `config:"read_size"`
|
||||
StartYear int `config:"start_year"`
|
||||
ReadOnly bool `config:"read_only"`
|
||||
ReadSize bool `config:"read_size"`
|
||||
StartYear int `config:"start_year"`
|
||||
IncludeArchived bool `config:"include_archived"`
|
||||
}
|
||||
|
||||
// Fs represents a remote storage server
|
||||
@@ -206,6 +224,10 @@ func (f *Fs) startYear() int {
|
||||
return f.opt.StartYear
|
||||
}
|
||||
|
||||
func (f *Fs) includeArchived() bool {
|
||||
return f.opt.IncludeArchived
|
||||
}
|
||||
|
||||
// retryErrorCodes is a slice of error codes that we will retry
|
||||
var retryErrorCodes = []int{
|
||||
429, // Too Many Requests.
|
||||
@@ -497,6 +519,12 @@ func (f *Fs) list(ctx context.Context, filter api.SearchFilter, fn listFn) (err
|
||||
}
|
||||
filter.PageSize = listChunks
|
||||
filter.PageToken = ""
|
||||
if filter.AlbumID == "" { // album ID and filters cannot be set together, else error 400 INVALID_ARGUMENT
|
||||
if filter.Filters == nil {
|
||||
filter.Filters = &api.Filters{}
|
||||
}
|
||||
filter.Filters.IncludeArchivedMedia = &f.opt.IncludeArchived
|
||||
}
|
||||
lastID := ""
|
||||
for {
|
||||
var result api.MediaItems
|
||||
|
||||
@@ -24,6 +24,7 @@ type lister interface {
|
||||
listUploads(ctx context.Context, dir string) (entries fs.DirEntries, err error)
|
||||
dirTime() time.Time
|
||||
startYear() int
|
||||
includeArchived() bool
|
||||
}
|
||||
|
||||
// dirPattern describes a single directory pattern
|
||||
|
||||
@@ -64,6 +64,11 @@ func (f *testLister) startYear() int {
|
||||
return 2000
|
||||
}
|
||||
|
||||
// mock includeArchived for testing
|
||||
func (f *testLister) includeArchived() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func TestPatternMatch(t *testing.T) {
|
||||
for testNumber, test := range []struct {
|
||||
// input
|
||||
|
||||
+66
-3
@@ -7,10 +7,15 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/user"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/colinmarc/hdfs/v2"
|
||||
krb "github.com/jcmturner/gokrb5/v8/client"
|
||||
"github.com/jcmturner/gokrb5/v8/config"
|
||||
"github.com/jcmturner/gokrb5/v8/credentials"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/config/configmap"
|
||||
"github.com/rclone/rclone/fs/config/configstruct"
|
||||
@@ -27,6 +32,49 @@ type Fs struct {
|
||||
client *hdfs.Client
|
||||
}
|
||||
|
||||
// copy-paste from https://github.com/colinmarc/hdfs/blob/master/cmd/hdfs/kerberos.go
|
||||
func getKerberosClient() (*krb.Client, error) {
|
||||
configPath := os.Getenv("KRB5_CONFIG")
|
||||
if configPath == "" {
|
||||
configPath = "/etc/krb5.conf"
|
||||
}
|
||||
|
||||
cfg, err := config.Load(configPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Determine the ccache location from the environment, falling back to the
|
||||
// default location.
|
||||
ccachePath := os.Getenv("KRB5CCNAME")
|
||||
if strings.Contains(ccachePath, ":") {
|
||||
if strings.HasPrefix(ccachePath, "FILE:") {
|
||||
ccachePath = strings.SplitN(ccachePath, ":", 2)[1]
|
||||
} else {
|
||||
return nil, fmt.Errorf("unusable ccache: %s", ccachePath)
|
||||
}
|
||||
} else if ccachePath == "" {
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ccachePath = fmt.Sprintf("/tmp/krb5cc_%s", u.Uid)
|
||||
}
|
||||
|
||||
ccache, err := credentials.LoadCCache(ccachePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client, err := krb.NewFromCCache(ccache, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return client, nil
|
||||
}
|
||||
|
||||
// NewFs constructs an Fs from the path
|
||||
func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {
|
||||
opt := new(Options)
|
||||
@@ -35,11 +83,26 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client, err := hdfs.NewClient(hdfs.ClientOptions{
|
||||
options := hdfs.ClientOptions{
|
||||
Addresses: []string{opt.Namenode},
|
||||
User: opt.Username,
|
||||
UseDatanodeHostname: false,
|
||||
})
|
||||
}
|
||||
|
||||
if opt.ServicePrincipalName != "" {
|
||||
options.KerberosClient, err = getKerberosClient()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Problem with kerberos authentication: %s", err)
|
||||
}
|
||||
options.KerberosServicePrincipleName = opt.ServicePrincipalName
|
||||
|
||||
if opt.DataTransferProtection != "" {
|
||||
options.DataTransferProtection = opt.DataTransferProtection
|
||||
}
|
||||
} else {
|
||||
options.User = opt.Username
|
||||
}
|
||||
|
||||
client, err := hdfs.NewClient(options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
+31
-3
@@ -32,6 +32,32 @@ func init() {
|
||||
Value: "root",
|
||||
Help: "Connect to hdfs as root",
|
||||
}},
|
||||
}, {
|
||||
Name: "service_principal_name",
|
||||
Help: `Kerberos service principal name for the namenode
|
||||
|
||||
Enables KERBEROS authentication. Specifies the Service Principal Name
|
||||
(<SERVICE>/<FQDN>) for the namenode.`,
|
||||
Required: false,
|
||||
Examples: []fs.OptionExample{{
|
||||
Value: "hdfs/namenode.hadoop.docker",
|
||||
Help: "Namenode running as service 'hdfs' with FQDN 'namenode.hadoop.docker'.",
|
||||
}},
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "data_transfer_protection",
|
||||
Help: `Kerberos data transfer protection: authentication|integrity|privacy
|
||||
|
||||
Specifies whether or not authentication, data signature integrity
|
||||
checks, and wire encryption is required when communicating the the
|
||||
datanodes. Possible values are 'authentication', 'integrity' and
|
||||
'privacy'. Used only with KERBEROS enabled.`,
|
||||
Required: false,
|
||||
Examples: []fs.OptionExample{{
|
||||
Value: "privacy",
|
||||
Help: "Ensure authentication, integrity and encryption enabled.",
|
||||
}},
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: config.ConfigEncoding,
|
||||
Help: config.ConfigEncodingHelp,
|
||||
@@ -44,9 +70,11 @@ func init() {
|
||||
|
||||
// Options for this backend
|
||||
type Options struct {
|
||||
Namenode string `config:"namenode"`
|
||||
Username string `config:"username"`
|
||||
Enc encoder.MultiEncoder `config:"encoding"`
|
||||
Namenode string `config:"namenode"`
|
||||
Username string `config:"username"`
|
||||
ServicePrincipalName string `config:"service_principal_name"`
|
||||
DataTransferProtection string `config:"data_transfer_protection"`
|
||||
Enc encoder.MultiEncoder `config:"encoding"`
|
||||
}
|
||||
|
||||
// xPath make correct file path with leading '/'
|
||||
|
||||
@@ -63,6 +63,10 @@ const (
|
||||
v1ClientID = "nibfk8biu12ju7hpqomr8b1e40"
|
||||
v1EncryptedClientSecret = "Vp8eAv7eVElMnQwN-kgU9cbhgApNDaMqWdlDi5qFydlQoji4JBxrGMF2"
|
||||
v1configVersion = 0
|
||||
|
||||
teliaCloudTokenURL = "https://cloud-auth.telia.se/auth/realms/telia_se/protocol/openid-connect/token"
|
||||
teliaCloudAuthURL = "https://cloud-auth.telia.se/auth/realms/telia_se/protocol/openid-connect/auth"
|
||||
teliaCloudClientID = "desktop"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -105,11 +109,18 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("Use legacy authentication?.\nThis is only required for certain whitelabel versions of Jottacloud and not recommended for normal users.\n")
|
||||
if config.Confirm(false) {
|
||||
v1config(ctx, name, m)
|
||||
} else {
|
||||
fmt.Printf("Choose authentication type:\n" +
|
||||
"1: Standard authentication - use this if you're a normal Jottacloud user.\n" +
|
||||
"2: Legacy authentication - this is only required for certain whitelabel versions of Jottacloud and not recommended for normal users.\n" +
|
||||
"3: Telia Cloud authentication - use this if you are using Telia Cloud.\n")
|
||||
|
||||
switch config.ChooseNumber("Your choice", 1, 3) {
|
||||
case 1:
|
||||
v2config(ctx, name, m)
|
||||
case 2:
|
||||
v1config(ctx, name, m)
|
||||
case 3:
|
||||
teliaCloudConfig(ctx, name, m)
|
||||
}
|
||||
},
|
||||
Options: []fs.Option{{
|
||||
@@ -228,6 +239,46 @@ func shouldRetry(resp *http.Response, err error) (bool, error) {
|
||||
return fserrors.ShouldRetry(err) || fserrors.ShouldRetryHTTP(resp, retryErrorCodes), err
|
||||
}
|
||||
|
||||
func teliaCloudConfig(ctx context.Context, name string, m configmap.Mapper) {
|
||||
teliaCloudOauthConfig := &oauth2.Config{
|
||||
Endpoint: oauth2.Endpoint{
|
||||
AuthURL: teliaCloudAuthURL,
|
||||
TokenURL: teliaCloudTokenURL,
|
||||
},
|
||||
ClientID: teliaCloudClientID,
|
||||
Scopes: []string{"openid", "jotta-default", "offline_access"},
|
||||
RedirectURL: oauthutil.RedirectLocalhostURL,
|
||||
}
|
||||
|
||||
err := oauthutil.Config(ctx, "jottacloud", name, m, teliaCloudOauthConfig, nil)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to configure token: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("\nDo you want to use a non standard device/mountpoint e.g. for accessing files uploaded using the official Jottacloud client?\n\n")
|
||||
if config.Confirm(false) {
|
||||
oAuthClient, _, err := oauthutil.NewClient(ctx, name, m, teliaCloudOauthConfig)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to load oAuthClient: %s", err)
|
||||
}
|
||||
|
||||
srv := rest.NewClient(oAuthClient).SetRoot(rootURL)
|
||||
apiSrv := rest.NewClient(oAuthClient).SetRoot(apiURL)
|
||||
|
||||
device, mountpoint, err := setupMountpoint(ctx, srv, apiSrv)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to setup mountpoint: %s", err)
|
||||
}
|
||||
m.Set(configDevice, device)
|
||||
m.Set(configMountpoint, mountpoint)
|
||||
}
|
||||
|
||||
m.Set("configVersion", strconv.Itoa(configVersion))
|
||||
m.Set(configClientID, teliaCloudClientID)
|
||||
m.Set(configTokenURL, teliaCloudTokenURL)
|
||||
}
|
||||
|
||||
// v1config configure a jottacloud backend using legacy authentication
|
||||
func v1config(ctx context.Context, name string, m configmap.Mapper) {
|
||||
srv := rest.NewClient(fshttp.NewClient(ctx))
|
||||
|
||||
+17
-1
@@ -70,6 +70,20 @@ points, as you explicitly acknowledge that they should be skipped.`,
|
||||
Default: false,
|
||||
NoPrefix: true,
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "zero_size_links",
|
||||
Help: `Assume the Stat size of links is zero (and read them instead)
|
||||
|
||||
On some virtual filesystems (such ash LucidLink), reading a link size via a Stat call always returns 0.
|
||||
However, on unix it reads as the length of the text in the link. This may cause errors like this when
|
||||
syncing:
|
||||
|
||||
Failed to copy: corrupted on transfer: sizes differ 0 vs 13
|
||||
|
||||
Setting this flag causes rclone to read the link and use that as the size of the link
|
||||
instead of 0 which in most cases fixes the problem.`,
|
||||
Default: false,
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "no_unicode_normalization",
|
||||
Help: `Don't apply unicode normalization to paths and filenames (Deprecated)
|
||||
@@ -170,6 +184,7 @@ type Options struct {
|
||||
FollowSymlinks bool `config:"copy_links"`
|
||||
TranslateSymlinks bool `config:"links"`
|
||||
SkipSymlinks bool `config:"skip_links"`
|
||||
ZeroSizeLinks bool `config:"zero_size_links"`
|
||||
NoUTFNorm bool `config:"no_unicode_normalization"`
|
||||
NoCheckUpdated bool `config:"no_check_updated"`
|
||||
NoUNC bool `config:"nounc"`
|
||||
@@ -1232,7 +1247,8 @@ func (o *Object) setMetadata(info os.FileInfo) {
|
||||
o.mode = info.Mode()
|
||||
o.fs.objectMetaMu.Unlock()
|
||||
// On Windows links read as 0 size so set the correct size here
|
||||
if runtime.GOOS == "windows" && o.translatedLink {
|
||||
// Optionally, users can turn this feature on with the zero_size_links flag
|
||||
if (runtime.GOOS == "windows" || o.fs.opt.ZeroSizeLinks) && o.translatedLink {
|
||||
linkdst, err := os.Readlink(o.path)
|
||||
if err != nil {
|
||||
fs.Errorf(o, "Failed to read link size: %v", err)
|
||||
|
||||
+200
-99
@@ -11,6 +11,7 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"regexp"
|
||||
"strconv"
|
||||
@@ -46,7 +47,6 @@ const (
|
||||
minSleep = 10 * time.Millisecond
|
||||
maxSleep = 2 * time.Second
|
||||
decayConstant = 2 // bigger for slower decay, exponential
|
||||
graphURL = "https://graph.microsoft.com/v1.0"
|
||||
configDriveID = "drive_id"
|
||||
configDriveType = "drive_type"
|
||||
driveTypePersonal = "personal"
|
||||
@@ -54,22 +54,40 @@ const (
|
||||
driveTypeSharepoint = "documentLibrary"
|
||||
defaultChunkSize = 10 * fs.MebiByte
|
||||
chunkSizeMultiple = 320 * fs.KibiByte
|
||||
|
||||
regionGlobal = "global"
|
||||
regionUS = "us"
|
||||
regionDE = "de"
|
||||
regionCN = "cn"
|
||||
)
|
||||
|
||||
// Globals
|
||||
var (
|
||||
authPath = "/common/oauth2/v2.0/authorize"
|
||||
tokenPath = "/common/oauth2/v2.0/token"
|
||||
|
||||
// Description of how to auth for this app for a business account
|
||||
oauthConfig = &oauth2.Config{
|
||||
Endpoint: oauth2.Endpoint{
|
||||
AuthURL: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
||||
TokenURL: "https://login.microsoftonline.com/common/oauth2/v2.0/token",
|
||||
},
|
||||
Scopes: []string{"Files.Read", "Files.ReadWrite", "Files.Read.All", "Files.ReadWrite.All", "offline_access", "Sites.Read.All"},
|
||||
ClientID: rcloneClientID,
|
||||
ClientSecret: obscure.MustReveal(rcloneEncryptedClientSecret),
|
||||
RedirectURL: oauthutil.RedirectLocalhostURL,
|
||||
}
|
||||
|
||||
graphAPIEndpoint = map[string]string{
|
||||
"global": "https://graph.microsoft.com",
|
||||
"us": "https://graph.microsoft.us",
|
||||
"de": "https://graph.microsoft.de",
|
||||
"cn": "https://microsoftgraph.chinacloudapi.cn",
|
||||
}
|
||||
|
||||
authEndpoint = map[string]string{
|
||||
"global": "https://login.microsoftonline.com",
|
||||
"us": "https://login.microsoftonline.us",
|
||||
"de": "https://login.microsoftonline.de",
|
||||
"cn": "https://login.chinacloudapi.cn",
|
||||
}
|
||||
|
||||
// QuickXorHashType is the hash.Type for OneDrive
|
||||
QuickXorHashType hash.Type
|
||||
)
|
||||
@@ -82,6 +100,12 @@ func init() {
|
||||
Description: "Microsoft OneDrive",
|
||||
NewFs: NewFs,
|
||||
Config: func(ctx context.Context, name string, m configmap.Mapper) {
|
||||
region, _ := m.Get("region")
|
||||
graphURL := graphAPIEndpoint[region] + "/v1.0"
|
||||
oauthConfig.Endpoint = oauth2.Endpoint{
|
||||
AuthURL: authEndpoint[region] + authPath,
|
||||
TokenURL: authEndpoint[region] + tokenPath,
|
||||
}
|
||||
ci := fs.GetConfig(ctx)
|
||||
err := oauthutil.Config(ctx, "onedrive", name, m, oauthConfig, nil)
|
||||
if err != nil {
|
||||
@@ -281,6 +305,25 @@ func init() {
|
||||
config.SaveConfig()
|
||||
},
|
||||
Options: append(oauthutil.SharedOptions, []fs.Option{{
|
||||
Name: "region",
|
||||
Help: "Choose national cloud region for OneDrive.",
|
||||
Default: "global",
|
||||
Examples: []fs.OptionExample{
|
||||
{
|
||||
Value: regionGlobal,
|
||||
Help: "Microsoft Cloud Global",
|
||||
}, {
|
||||
Value: regionUS,
|
||||
Help: "Microsoft Cloud for US Government",
|
||||
}, {
|
||||
Value: regionDE,
|
||||
Help: "Microsoft Cloud Germany",
|
||||
}, {
|
||||
Value: regionCN,
|
||||
Help: "Azure and Office 365 operated by 21Vianet in China",
|
||||
},
|
||||
},
|
||||
}, {
|
||||
Name: "chunk_size",
|
||||
Help: `Chunk size to upload files with - must be multiple of 320k (327,680 bytes).
|
||||
|
||||
@@ -420,6 +463,7 @@ At the time of writing this only works with OneDrive personal paid accounts.
|
||||
|
||||
// Options defines the configuration for this backend
|
||||
type Options struct {
|
||||
Region string `config:"region"`
|
||||
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
||||
DriveID string `config:"drive_id"`
|
||||
DriveType string `config:"drive_type"`
|
||||
@@ -549,10 +593,8 @@ func shouldRetry(resp *http.Response, err error) (bool, error) {
|
||||
//
|
||||
// If `relPath` == '', do not append the slash (See #3664)
|
||||
func (f *Fs) readMetaDataForPathRelativeToID(ctx context.Context, normalizedID string, relPath string) (info *api.Item, resp *http.Response, err error) {
|
||||
if relPath != "" {
|
||||
relPath = "/" + withTrailingColon(rest.URLPathEscape(f.opt.Enc.FromStandardPath(relPath)))
|
||||
}
|
||||
opts := newOptsCall(normalizedID, "GET", ":"+relPath)
|
||||
opts, _ := f.newOptsCallWithIDPath(normalizedID, relPath, true, "GET", "")
|
||||
|
||||
err = f.pacer.Call(func() (bool, error) {
|
||||
resp, err = f.srv.CallJSON(ctx, &opts, nil, &info)
|
||||
return shouldRetry(resp, err)
|
||||
@@ -567,17 +609,8 @@ func (f *Fs) readMetaDataForPath(ctx context.Context, path string) (info *api.It
|
||||
|
||||
if f.driveType != driveTypePersonal || firstSlashIndex == -1 {
|
||||
var opts rest.Opts
|
||||
if len(path) == 0 {
|
||||
opts = rest.Opts{
|
||||
Method: "GET",
|
||||
Path: "/root",
|
||||
}
|
||||
} else {
|
||||
opts = rest.Opts{
|
||||
Method: "GET",
|
||||
Path: "/root:/" + rest.URLPathEscape(f.opt.Enc.FromStandardPath(path)),
|
||||
}
|
||||
}
|
||||
opts = f.newOptsCallWithPath(ctx, path, "GET", "")
|
||||
opts.Path = strings.TrimSuffix(opts.Path, ":")
|
||||
err = f.pacer.Call(func() (bool, error) {
|
||||
resp, err = f.srv.CallJSON(ctx, &opts, nil, &info)
|
||||
return shouldRetry(resp, err)
|
||||
@@ -688,6 +721,12 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
return nil, errors.New("unable to get drive_id and drive_type - if you are upgrading from older versions of rclone, please run `rclone config` and re-configure this backend")
|
||||
}
|
||||
|
||||
rootURL := graphAPIEndpoint[opt.Region] + "/v1.0" + "/drives/" + opt.DriveID
|
||||
oauthConfig.Endpoint = oauth2.Endpoint{
|
||||
AuthURL: authEndpoint[opt.Region] + authPath,
|
||||
TokenURL: authEndpoint[opt.Region] + tokenPath,
|
||||
}
|
||||
|
||||
root = parsePath(root)
|
||||
oAuthClient, ts, err := oauthutil.NewClient(ctx, name, m, oauthConfig)
|
||||
if err != nil {
|
||||
@@ -702,7 +741,7 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||
ci: ci,
|
||||
driveID: opt.DriveID,
|
||||
driveType: opt.DriveType,
|
||||
srv: rest.NewClient(oAuthClient).SetRoot(graphURL + "/drives/" + opt.DriveID),
|
||||
srv: rest.NewClient(oAuthClient).SetRoot(rootURL),
|
||||
pacer: fs.NewPacer(ctx, pacer.NewDefault(pacer.MinSleep(minSleep), pacer.MaxSleep(maxSleep), pacer.DecayConstant(decayConstant))),
|
||||
}
|
||||
f.features = (&fs.Features{
|
||||
@@ -823,7 +862,7 @@ func (f *Fs) CreateDir(ctx context.Context, dirID, leaf string) (newID string, e
|
||||
// fs.Debugf(f, "CreateDir(%q, %q)\n", dirID, leaf)
|
||||
var resp *http.Response
|
||||
var info *api.Item
|
||||
opts := newOptsCall(dirID, "POST", "/children")
|
||||
opts := f.newOptsCall(dirID, "POST", "/children")
|
||||
mkdir := api.CreateItemRequest{
|
||||
Name: f.opt.Enc.FromStandardName(leaf),
|
||||
ConflictBehavior: "fail",
|
||||
@@ -855,7 +894,7 @@ type listAllFn func(*api.Item) bool
|
||||
func (f *Fs) listAll(ctx context.Context, dirID string, directoriesOnly bool, filesOnly bool, fn listAllFn) (found bool, err error) {
|
||||
// Top parameter asks for bigger pages of data
|
||||
// https://dev.onedrive.com/odata/optional-query-parameters.htm
|
||||
opts := newOptsCall(dirID, "GET", "/children?$top=1000")
|
||||
opts := f.newOptsCall(dirID, "GET", "/children?$top=1000")
|
||||
OUTER:
|
||||
for {
|
||||
var result api.ListChildrenResponse
|
||||
@@ -994,7 +1033,7 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error {
|
||||
|
||||
// deleteObject removes an object by ID
|
||||
func (f *Fs) deleteObject(ctx context.Context, id string) error {
|
||||
opts := newOptsCall(id, "DELETE", "")
|
||||
opts := f.newOptsCall(id, "DELETE", "")
|
||||
opts.NoResponse = true
|
||||
|
||||
return f.pacer.Call(func() (bool, error) {
|
||||
@@ -1138,11 +1177,11 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
||||
|
||||
// Copy the object
|
||||
// The query param is a workaround for OneDrive Business for #4590
|
||||
opts := newOptsCall(srcObj.id, "POST", "/copy?@microsoft.graph.conflictBehavior=replace")
|
||||
opts := f.newOptsCall(srcObj.id, "POST", "/copy?@microsoft.graph.conflictBehavior=replace")
|
||||
opts.ExtraHeaders = map[string]string{"Prefer": "respond-async"}
|
||||
opts.NoResponse = true
|
||||
|
||||
id, dstDriveID, _ := parseNormalizedID(directoryID)
|
||||
id, dstDriveID, _ := f.parseNormalizedID(directoryID)
|
||||
|
||||
replacedLeaf := f.opt.Enc.FromStandardName(leaf)
|
||||
copyReq := api.CopyItemRequest{
|
||||
@@ -1219,8 +1258,8 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
id, dstDriveID, _ := parseNormalizedID(directoryID)
|
||||
_, srcObjDriveID, _ := parseNormalizedID(srcObj.id)
|
||||
id, dstDriveID, _ := f.parseNormalizedID(directoryID)
|
||||
_, srcObjDriveID, _ := f.parseNormalizedID(srcObj.id)
|
||||
|
||||
if f.canonicalDriveID(dstDriveID) != srcObj.fs.canonicalDriveID(srcObjDriveID) {
|
||||
// https://docs.microsoft.com/en-us/graph/api/driveitem-move?view=graph-rest-1.0
|
||||
@@ -1230,7 +1269,7 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
|
||||
}
|
||||
|
||||
// Move the object
|
||||
opts := newOptsCall(srcObj.id, "PATCH", "")
|
||||
opts := f.newOptsCall(srcObj.id, "PATCH", "")
|
||||
|
||||
move := api.MoveItemRequest{
|
||||
Name: f.opt.Enc.FromStandardName(leaf),
|
||||
@@ -1281,8 +1320,8 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
|
||||
return err
|
||||
}
|
||||
|
||||
parsedDstDirID, dstDriveID, _ := parseNormalizedID(dstDirectoryID)
|
||||
_, srcDriveID, _ := parseNormalizedID(srcID)
|
||||
parsedDstDirID, dstDriveID, _ := f.parseNormalizedID(dstDirectoryID)
|
||||
_, srcDriveID, _ := f.parseNormalizedID(srcID)
|
||||
|
||||
if f.canonicalDriveID(dstDriveID) != srcFs.canonicalDriveID(srcDriveID) {
|
||||
// https://docs.microsoft.com/en-us/graph/api/driveitem-move?view=graph-rest-1.0
|
||||
@@ -1298,7 +1337,7 @@ func (f *Fs) DirMove(ctx context.Context, src fs.Fs, srcRemote, dstRemote string
|
||||
}
|
||||
|
||||
// Do the move
|
||||
opts := newOptsCall(srcID, "PATCH", "")
|
||||
opts := f.newOptsCall(srcID, "PATCH", "")
|
||||
move := api.MoveItemRequest{
|
||||
Name: f.opt.Enc.FromStandardName(dstLeaf),
|
||||
ParentReference: &api.ItemReference{
|
||||
@@ -1374,7 +1413,7 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration,
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
opts := newOptsCall(info.GetID(), "POST", "/createLink")
|
||||
opts := f.newOptsCall(info.GetID(), "POST", "/createLink")
|
||||
|
||||
share := api.CreateShareLinkRequest{
|
||||
Type: f.opt.LinkType,
|
||||
@@ -1432,7 +1471,7 @@ func (f *Fs) CleanUp(ctx context.Context) error {
|
||||
|
||||
// Finds and removes any old versions for o
|
||||
func (o *Object) deleteVersions(ctx context.Context) error {
|
||||
opts := newOptsCall(o.id, "GET", "/versions")
|
||||
opts := o.fs.newOptsCall(o.id, "GET", "/versions")
|
||||
var versions api.VersionsResponse
|
||||
err := o.fs.pacer.Call(func() (bool, error) {
|
||||
resp, err := o.fs.srv.CallJSON(ctx, &opts, nil, &versions)
|
||||
@@ -1459,7 +1498,7 @@ func (o *Object) deleteVersion(ctx context.Context, ID string) error {
|
||||
return nil
|
||||
}
|
||||
fs.Infof(o, "removing version %q", ID)
|
||||
opts := newOptsCall(o.id, "DELETE", "/versions/"+ID)
|
||||
opts := o.fs.newOptsCall(o.id, "DELETE", "/versions/"+ID)
|
||||
opts.NoResponse = true
|
||||
return o.fs.pacer.Call(func() (bool, error) {
|
||||
resp, err := o.fs.srv.Call(ctx, &opts)
|
||||
@@ -1604,21 +1643,7 @@ func (o *Object) ModTime(ctx context.Context) time.Time {
|
||||
|
||||
// setModTime sets the modification time of the local fs object
|
||||
func (o *Object) setModTime(ctx context.Context, modTime time.Time) (*api.Item, error) {
|
||||
var opts rest.Opts
|
||||
leaf, directoryID, _ := o.fs.dirCache.FindPath(ctx, o.remote, false)
|
||||
trueDirID, drive, rootURL := parseNormalizedID(directoryID)
|
||||
if drive != "" {
|
||||
opts = rest.Opts{
|
||||
Method: "PATCH",
|
||||
RootURL: rootURL,
|
||||
Path: "/" + drive + "/items/" + trueDirID + ":/" + withTrailingColon(rest.URLPathEscape(o.fs.opt.Enc.FromStandardName(leaf))),
|
||||
}
|
||||
} else {
|
||||
opts = rest.Opts{
|
||||
Method: "PATCH",
|
||||
Path: "/root:/" + withTrailingColon(rest.URLPathEscape(o.srvPath())),
|
||||
}
|
||||
}
|
||||
opts := o.fs.newOptsCallWithPath(ctx, o.remote, "PATCH", "")
|
||||
update := api.SetFileSystemInfo{
|
||||
FileSystemInfo: api.FileSystemInfoFacet{
|
||||
CreatedDateTime: api.Timestamp(modTime),
|
||||
@@ -1665,7 +1690,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
|
||||
|
||||
fs.FixRangeOption(options, o.size)
|
||||
var resp *http.Response
|
||||
opts := newOptsCall(o.id, "GET", "/content")
|
||||
opts := o.fs.newOptsCall(o.id, "GET", "/content")
|
||||
opts.Options = options
|
||||
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
@@ -1685,22 +1710,7 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (in io.Read
|
||||
|
||||
// createUploadSession creates an upload session for the object
|
||||
func (o *Object) createUploadSession(ctx context.Context, modTime time.Time) (response *api.CreateUploadResponse, err error) {
|
||||
leaf, directoryID, _ := o.fs.dirCache.FindPath(ctx, o.remote, false)
|
||||
id, drive, rootURL := parseNormalizedID(directoryID)
|
||||
var opts rest.Opts
|
||||
if drive != "" {
|
||||
opts = rest.Opts{
|
||||
Method: "POST",
|
||||
RootURL: rootURL,
|
||||
Path: fmt.Sprintf("/%s/items/%s:/%s:/createUploadSession",
|
||||
drive, id, rest.URLPathEscape(o.fs.opt.Enc.FromStandardName(leaf))),
|
||||
}
|
||||
} else {
|
||||
opts = rest.Opts{
|
||||
Method: "POST",
|
||||
Path: "/root:/" + rest.URLPathEscape(o.srvPath()) + ":/createUploadSession",
|
||||
}
|
||||
}
|
||||
opts := o.fs.newOptsCallWithPath(ctx, o.remote, "POST", "/createUploadSession")
|
||||
createRequest := api.CreateUploadRequest{}
|
||||
createRequest.Item.FileSystemInfo.CreatedDateTime = api.Timestamp(modTime)
|
||||
createRequest.Item.FileSystemInfo.LastModifiedDateTime = api.Timestamp(modTime)
|
||||
@@ -1873,27 +1883,10 @@ func (o *Object) uploadSinglepart(ctx context.Context, in io.Reader, size int64,
|
||||
|
||||
fs.Debugf(o, "Starting singlepart upload")
|
||||
var resp *http.Response
|
||||
var opts rest.Opts
|
||||
leaf, directoryID, _ := o.fs.dirCache.FindPath(ctx, o.remote, false)
|
||||
trueDirID, drive, rootURL := parseNormalizedID(directoryID)
|
||||
if drive != "" {
|
||||
opts = rest.Opts{
|
||||
Method: "PUT",
|
||||
RootURL: rootURL,
|
||||
Path: "/" + drive + "/items/" + trueDirID + ":/" + rest.URLPathEscape(o.fs.opt.Enc.FromStandardName(leaf)) + ":/content",
|
||||
ContentLength: &size,
|
||||
Body: in,
|
||||
Options: options,
|
||||
}
|
||||
} else {
|
||||
opts = rest.Opts{
|
||||
Method: "PUT",
|
||||
Path: "/root:/" + rest.URLPathEscape(o.srvPath()) + ":/content",
|
||||
ContentLength: &size,
|
||||
Body: in,
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
opts := o.fs.newOptsCallWithPath(ctx, o.remote, "PUT", "/content")
|
||||
opts.ContentLength = &size
|
||||
opts.Body = in
|
||||
opts.Options = options
|
||||
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
resp, err = o.fs.srv.CallJSON(ctx, &opts, nil, &info)
|
||||
@@ -1969,8 +1962,42 @@ func (o *Object) ID() string {
|
||||
return o.id
|
||||
}
|
||||
|
||||
func newOptsCall(normalizedID string, method string, route string) (opts rest.Opts) {
|
||||
id, drive, rootURL := parseNormalizedID(normalizedID)
|
||||
/*
|
||||
* URL Build routine area start
|
||||
* 1. In this area, region-related URL rewrites are applied. As the API is blackbox,
|
||||
* we cannot thoroughly test this part. Please be extremely careful while changing them.
|
||||
* 2. If possible, please don't introduce region related code in other region, but patch these helper functions.
|
||||
* 3. To avoid region-related issues, please don't manually build rest.Opts from scratch.
|
||||
* Instead, use these helper function, and customize the URL afterwards if needed.
|
||||
*
|
||||
* currently, the 21ViaNet's API differs in the following places:
|
||||
* - https://{Endpoint}/drives/{driveID}/items/{leaf}:/{route}
|
||||
* - this API doesn't work (gives invalid request)
|
||||
* - can be replaced with the following API:
|
||||
* - https://{Endpoint}/drives/{driveID}/items/children('{leaf}')/{route}
|
||||
* - however, this API does NOT support multi-level leaf like a/b/c
|
||||
* - https://{Endpoint}/drives/{driveID}/items/children('@a1')/{route}?@a1=URLEncode("'{leaf}'")
|
||||
* - this API does support multi-level leaf like a/b/c
|
||||
* - https://{Endpoint}/drives/{driveID}/root/children('@a1')/{route}?@a1=URLEncode({path})
|
||||
* - Same as above
|
||||
*/
|
||||
|
||||
// parseNormalizedID parses a normalized ID (may be in the form `driveID#itemID` or just `itemID`)
|
||||
// and returns itemID, driveID, rootURL.
|
||||
// Such a normalized ID can come from (*Item).GetID()
|
||||
func (f *Fs) parseNormalizedID(ID string) (string, string, string) {
|
||||
rootURL := graphAPIEndpoint[f.opt.Region] + "/v1.0/drives"
|
||||
if strings.Index(ID, "#") >= 0 {
|
||||
s := strings.Split(ID, "#")
|
||||
return s[1], s[0], rootURL
|
||||
}
|
||||
return ID, "", ""
|
||||
}
|
||||
|
||||
// newOptsCall build the rest.Opts structure with *a normalizedID(driveID#fileID, or simply fileID)*
|
||||
// using url template https://{Endpoint}/drives/{driveID}/items/{itemID}/{route}
|
||||
func (f *Fs) newOptsCall(normalizedID string, method string, route string) (opts rest.Opts) {
|
||||
id, drive, rootURL := f.parseNormalizedID(normalizedID)
|
||||
|
||||
if drive != "" {
|
||||
return rest.Opts{
|
||||
@@ -1985,17 +2012,91 @@ func newOptsCall(normalizedID string, method string, route string) (opts rest.Op
|
||||
}
|
||||
}
|
||||
|
||||
// parseNormalizedID parses a normalized ID (may be in the form `driveID#itemID` or just `itemID`)
|
||||
// and returns itemID, driveID, rootURL.
|
||||
// Such a normalized ID can come from (*Item).GetID()
|
||||
func parseNormalizedID(ID string) (string, string, string) {
|
||||
if strings.Index(ID, "#") >= 0 {
|
||||
s := strings.Split(ID, "#")
|
||||
return s[1], s[0], graphURL + "/drives"
|
||||
}
|
||||
return ID, "", ""
|
||||
func escapeSingleQuote(str string) string {
|
||||
return strings.ReplaceAll(str, "'", "''")
|
||||
}
|
||||
|
||||
// newOptsCallWithIDPath build the rest.Opts structure with *a normalizedID (driveID#fileID, or simply fileID) and leaf*
|
||||
// using url template https://{Endpoint}/drives/{driveID}/items/{leaf}:/{route} (for international OneDrive)
|
||||
// or https://{Endpoint}/drives/{driveID}/items/children('{leaf}')/{route}
|
||||
// and https://{Endpoint}/drives/{driveID}/items/children('@a1')/{route}?@a1=URLEncode("'{leaf}'") (for 21ViaNet)
|
||||
// if isPath is false, this function will only work when the leaf is "" or a child name (i.e. it doesn't accept multi-level leaf)
|
||||
// if isPath is true, multi-level leaf like a/b/c can be passed
|
||||
func (f *Fs) newOptsCallWithIDPath(normalizedID string, leaf string, isPath bool, method string, route string) (opts rest.Opts, ok bool) {
|
||||
encoder := f.opt.Enc.FromStandardName
|
||||
if isPath {
|
||||
encoder = f.opt.Enc.FromStandardPath
|
||||
}
|
||||
trueDirID, drive, rootURL := f.parseNormalizedID(normalizedID)
|
||||
if drive == "" {
|
||||
trueDirID = normalizedID
|
||||
}
|
||||
entity := "/items/" + trueDirID + ":/" + withTrailingColon(rest.URLPathEscape(encoder(leaf))) + route
|
||||
if f.opt.Region == regionCN {
|
||||
if isPath {
|
||||
entity = "/items/" + trueDirID + "/children('@a1')" + route + "?@a1=" + url.QueryEscape("'"+encoder(escapeSingleQuote(leaf))+"'")
|
||||
} else {
|
||||
entity = "/items/" + trueDirID + "/children('" + rest.URLPathEscape(encoder(escapeSingleQuote(leaf))) + "')" + route
|
||||
}
|
||||
}
|
||||
if drive == "" {
|
||||
ok = false
|
||||
opts = rest.Opts{
|
||||
Method: method,
|
||||
Path: entity,
|
||||
}
|
||||
return
|
||||
}
|
||||
ok = true
|
||||
opts = rest.Opts{
|
||||
Method: method,
|
||||
RootURL: rootURL,
|
||||
Path: "/" + drive + entity,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// newOptsCallWithIDPath build the rest.Opts structure with an *absolute path start from root*
|
||||
// using url template https://{Endpoint}/drives/{driveID}/root:/{path}:/{route}
|
||||
// or https://{Endpoint}/drives/{driveID}/root/children('@a1')/{route}?@a1=URLEncode({path})
|
||||
func (f *Fs) newOptsCallWithRootPath(path string, method string, route string) (opts rest.Opts) {
|
||||
path = strings.TrimSuffix(path, "/")
|
||||
newURL := "/root:/" + withTrailingColon(rest.URLPathEscape(f.opt.Enc.FromStandardPath(path))) + route
|
||||
if f.opt.Region == regionCN {
|
||||
newURL = "/root/children('@a1')" + route + "?@a1=" + url.QueryEscape("'"+escapeSingleQuote(f.opt.Enc.FromStandardPath(path))+"'")
|
||||
}
|
||||
return rest.Opts{
|
||||
Method: method,
|
||||
Path: newURL,
|
||||
}
|
||||
}
|
||||
|
||||
// newOptsCallWithPath build the rest.Opt intelligently.
|
||||
// It will first try to resolve the path using dircache, which enables support for "Share with me" files.
|
||||
// If present in cache, then use ID + Path variant, else fallback into RootPath variant
|
||||
func (f *Fs) newOptsCallWithPath(ctx context.Context, path string, method string, route string) (opts rest.Opts) {
|
||||
if path == "" {
|
||||
url := "/root" + route
|
||||
return rest.Opts{
|
||||
Method: method,
|
||||
Path: url,
|
||||
}
|
||||
}
|
||||
|
||||
// find dircache
|
||||
leaf, directoryID, _ := f.dirCache.FindPath(ctx, path, false)
|
||||
// try to use IDPath variant first
|
||||
if opts, ok := f.newOptsCallWithIDPath(directoryID, leaf, false, method, route); ok {
|
||||
return opts
|
||||
}
|
||||
// fallback to use RootPath variant first
|
||||
return f.newOptsCallWithRootPath(path, method, route)
|
||||
}
|
||||
|
||||
/*
|
||||
* URL Build routine area end
|
||||
*/
|
||||
|
||||
// Returns the canonical form of the driveID
|
||||
func (f *Fs) canonicalDriveID(driveID string) (canonicalDriveID string) {
|
||||
if driveID == "" {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fstest"
|
||||
"github.com/rclone/rclone/fstest/fstests"
|
||||
)
|
||||
|
||||
@@ -19,6 +20,20 @@ func TestIntegration(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// TestIntegrationCn runs integration tests against the remote
|
||||
func TestIntegrationCn(t *testing.T) {
|
||||
if *fstest.RemoteName != "" {
|
||||
t.Skip("skipping as -remote is set")
|
||||
}
|
||||
fstests.Run(t, &fstests.Opt{
|
||||
RemoteName: "TestOneDriveCn:",
|
||||
NilObject: (*Object)(nil),
|
||||
ChunkedUpload: fstests.ChunkedUploadConfig{
|
||||
CeilChunkSize: fstests.NextMultipleOf(chunkSizeMultiple),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (f *Fs) SetUploadChunkSize(cs fs.SizeSuffix) (fs.SizeSuffix, error) {
|
||||
return f.setUploadChunkSize(cs)
|
||||
}
|
||||
|
||||
@@ -721,7 +721,7 @@ func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut strin
|
||||
for _, folder := range folderList.Folders {
|
||||
// fs.Debugf(nil, "Folder: %s (%s)", folder.Name, folder.FolderID)
|
||||
|
||||
if leaf == folder.Name {
|
||||
if strings.EqualFold(leaf, folder.Name) {
|
||||
// found
|
||||
return folder.FolderID, true, nil
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
|
||||
func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut string, found bool, err error) {
|
||||
// Find the leaf in pathID
|
||||
found, err = f.listAll(ctx, pathID, true, false, func(item *api.Item) bool {
|
||||
if item.Name == leaf {
|
||||
if strings.EqualFold(item.Name, leaf) {
|
||||
pathIDOut = item.ID
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -872,11 +872,12 @@ func (f *Fs) cleanUpBucket(ctx context.Context, bucket string) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
maxLimit := int(listLimitSize)
|
||||
// maxLimit := int(listLimitSize)
|
||||
var marker *string
|
||||
for {
|
||||
req := qs.ListMultipartUploadsInput{
|
||||
Limit: &maxLimit,
|
||||
// The default is 200 but this errors if more than 200 is put in so leave at the default
|
||||
// Limit: &maxLimit,
|
||||
KeyMarker: marker,
|
||||
}
|
||||
var resp *qs.ListMultipartUploadsOutput
|
||||
@@ -927,7 +928,7 @@ func (f *Fs) CleanUp(ctx context.Context) (err error) {
|
||||
}
|
||||
for _, entry := range entries {
|
||||
cleanErr := f.cleanUpBucket(ctx, f.opt.Enc.FromStandardName(entry.Remote()))
|
||||
if err != nil {
|
||||
if cleanErr != nil {
|
||||
fs.Errorf(f, "Failed to cleanup bucket: %q", cleanErr)
|
||||
err = cleanErr
|
||||
}
|
||||
|
||||
+57
-1
@@ -1185,6 +1185,39 @@ rclone does if you know the bucket exists already.
|
||||
It can also be needed if the user you are using does not have bucket
|
||||
creation permissions. Before v1.52.0 this would have passed silently
|
||||
due to a bug.
|
||||
`,
|
||||
Default: false,
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "no_head",
|
||||
Help: `If set, don't HEAD uploaded objects to check integrity
|
||||
|
||||
This can be useful when trying to minimise the number of transactions
|
||||
rclone does.
|
||||
|
||||
Setting it means that if rclone receives a 200 OK message after
|
||||
uploading an object with PUT then it will assume that it got uploaded
|
||||
properly.
|
||||
|
||||
In particular it will assume:
|
||||
|
||||
- the metadata, including modtime, storage class and content type was as uploaded
|
||||
- the size was as uploaded
|
||||
|
||||
It reads the following items from the response for a single part PUT:
|
||||
|
||||
- the MD5SUM
|
||||
- The uploaded date
|
||||
|
||||
For multipart uploads these items aren't read.
|
||||
|
||||
If an source object of unknown length is uploaded then rclone **will** do a
|
||||
HEAD request.
|
||||
|
||||
Setting this flag increases the chance for undetected upload failures,
|
||||
in particular an incorrect size, so it isn't recommended for normal
|
||||
operation. In practice the chance of an undetected upload failure is
|
||||
very small even with this flag.
|
||||
`,
|
||||
Default: false,
|
||||
Advanced: true,
|
||||
@@ -1285,6 +1318,7 @@ type Options struct {
|
||||
LeavePartsOnError bool `config:"leave_parts_on_error"`
|
||||
ListChunk int64 `config:"list_chunk"`
|
||||
NoCheckBucket bool `config:"no_check_bucket"`
|
||||
NoHead bool `config:"no_head"`
|
||||
Enc encoder.MultiEncoder `config:"encoding"`
|
||||
MemoryPoolFlushTime fs.Duration `config:"memory_pool_flush_time"`
|
||||
MemoryPoolUseMmap bool `config:"memory_pool_use_mmap"`
|
||||
@@ -3234,6 +3268,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
}
|
||||
}
|
||||
|
||||
var resp *http.Response // response from PUT
|
||||
if multipart {
|
||||
err = o.uploadMultipart(ctx, &req, size, in)
|
||||
if err != nil {
|
||||
@@ -3274,7 +3309,8 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
httpReq.ContentLength = size
|
||||
|
||||
err = o.fs.pacer.CallNoRetry(func() (bool, error) {
|
||||
resp, err := o.fs.srv.Do(httpReq)
|
||||
var err error
|
||||
resp, err = o.fs.srv.Do(httpReq)
|
||||
if err != nil {
|
||||
return o.fs.shouldRetry(err)
|
||||
}
|
||||
@@ -3293,6 +3329,26 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
}
|
||||
}
|
||||
|
||||
// User requested we don't HEAD the object after uploading it
|
||||
// so make up the object as best we can assuming it got
|
||||
// uploaded properly. If size < 0 then we need to do the HEAD.
|
||||
if o.fs.opt.NoHead && size >= 0 {
|
||||
o.md5 = md5sum
|
||||
o.bytes = size
|
||||
o.lastModified = time.Now()
|
||||
o.meta = req.Metadata
|
||||
o.mimeType = aws.StringValue(req.ContentType)
|
||||
o.storageClass = aws.StringValue(req.StorageClass)
|
||||
// If we have done a single part PUT request then we can read these
|
||||
if resp != nil {
|
||||
if date, err := http.ParseTime(resp.Header.Get("Date")); err == nil {
|
||||
o.lastModified = date
|
||||
}
|
||||
o.setMD5FromEtag(resp.Header.Get("Etag"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Read the metadata from the newly created object
|
||||
o.meta = nil // wipe old metadata
|
||||
err = o.readMetaData(ctx)
|
||||
|
||||
+13
-3
@@ -53,6 +53,7 @@ func sign(AccessKey, SecretKey string, req *http.Request) {
|
||||
var md5 string
|
||||
var contentType string
|
||||
var headersToSign []string
|
||||
tmpHeadersToSign := make(map[string][]string)
|
||||
for k, v := range req.Header {
|
||||
k = strings.ToLower(k)
|
||||
switch k {
|
||||
@@ -62,15 +63,24 @@ func sign(AccessKey, SecretKey string, req *http.Request) {
|
||||
contentType = v[0]
|
||||
default:
|
||||
if strings.HasPrefix(k, "x-amz-") {
|
||||
vall := strings.Join(v, ",")
|
||||
headersToSign = append(headersToSign, k+":"+vall)
|
||||
tmpHeadersToSign[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
var keys []string
|
||||
for k := range tmpHeadersToSign {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
// https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html
|
||||
sort.Strings(keys)
|
||||
|
||||
for _, key := range keys {
|
||||
vall := strings.Join(tmpHeadersToSign[key], ",")
|
||||
headersToSign = append(headersToSign, key+":"+vall)
|
||||
}
|
||||
// Make headers of interest into canonical string
|
||||
var joinedHeadersToSign string
|
||||
if len(headersToSign) > 0 {
|
||||
sort.StringSlice(headersToSign).Sort()
|
||||
joinedHeadersToSign = strings.Join(headersToSign, "\n") + "\n"
|
||||
}
|
||||
|
||||
|
||||
@@ -192,6 +192,20 @@ Home directory can be found in a shared folder called "home"
|
||||
|
||||
The subsystem option is ignored when server_command is defined.`,
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "use_fstat",
|
||||
Default: false,
|
||||
Help: `If set use fstat instead of stat
|
||||
|
||||
Some servers limit the amount of open files and calling Stat after opening
|
||||
the file will throw an error from the server. Setting this flag will call
|
||||
Fstat instead of Stat which is called on an already open file handle.
|
||||
|
||||
It has been found that this helps with IBM Sterling SFTP servers which have
|
||||
"extractability" level set to 1 which means only 1 file can be opened at
|
||||
any given time.
|
||||
`,
|
||||
Advanced: true,
|
||||
}},
|
||||
}
|
||||
fs.Register(fsi)
|
||||
@@ -219,6 +233,7 @@ type Options struct {
|
||||
SkipLinks bool `config:"skip_links"`
|
||||
Subsystem string `config:"subsystem"`
|
||||
ServerCommand string `config:"server_command"`
|
||||
UseFstat bool `config:"use_fstat"`
|
||||
}
|
||||
|
||||
// Fs stores the interface to the remote SFTP files
|
||||
@@ -344,6 +359,8 @@ func (f *Fs) newSftpClient(conn *ssh.Client, opts ...sftp.ClientOption) (*sftp.C
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
opts = opts[:len(opts):len(opts)] // make sure we don't overwrite the callers opts
|
||||
opts = append(opts, sftp.UseFstat(f.opt.UseFstat))
|
||||
|
||||
return sftp.NewClientPipe(pr, pw, opts...)
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ func (f *Fs) FindLeaf(ctx context.Context, pathID, leaf string) (pathIDOut strin
|
||||
//fs.Debugf(f, "FindLeaf(%q, %q)", pathID, leaf)
|
||||
// Find the leaf in pathID
|
||||
found, err = f.listAll(ctx, pathID, nil, func(item *api.Collection) bool {
|
||||
if item.Name == leaf {
|
||||
if strings.EqualFold(item.Name, leaf) {
|
||||
pathIDOut = item.Ref
|
||||
return true
|
||||
}
|
||||
|
||||
+74
-87
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/rclone/rclone/fs/hash"
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
"github.com/rclone/rclone/fs/walk"
|
||||
"github.com/rclone/rclone/lib/atexit"
|
||||
"github.com/rclone/rclone/lib/bucket"
|
||||
"github.com/rclone/rclone/lib/encoder"
|
||||
"github.com/rclone/rclone/lib/pacer"
|
||||
@@ -167,6 +168,11 @@ func init() {
|
||||
Help: "Admin",
|
||||
Value: "admin",
|
||||
}},
|
||||
}, {
|
||||
Name: "leave_parts_on_error",
|
||||
Help: `If true avoid calling abort upload on a failure. It should be set to true for resuming uploads across different sessions.`,
|
||||
Default: false,
|
||||
Advanced: true,
|
||||
}, {
|
||||
Name: "storage_policy",
|
||||
Help: `The storage policy to use when creating a new container
|
||||
@@ -208,6 +214,7 @@ type Options struct {
|
||||
ApplicationCredentialID string `config:"application_credential_id"`
|
||||
ApplicationCredentialName string `config:"application_credential_name"`
|
||||
ApplicationCredentialSecret string `config:"application_credential_secret"`
|
||||
LeavePartsOnError bool `config:"leave_parts_on_error"`
|
||||
StoragePolicy string `config:"storage_policy"`
|
||||
EndpointType string `config:"endpoint_type"`
|
||||
ChunkSize fs.SizeSuffix `config:"chunk_size"`
|
||||
@@ -1127,44 +1134,35 @@ func min(x, y int64) int64 {
|
||||
return y
|
||||
}
|
||||
|
||||
// removeSegments removes any old segments from o
|
||||
//
|
||||
// if except is passed in then segments with that prefix won't be deleted
|
||||
func (o *Object) removeSegments(except string) error {
|
||||
segmentsContainer, _, err := o.getSegmentsDlo()
|
||||
func (o *Object) getSegmentsLargeObject() (map[string][]string, error) {
|
||||
container, objectName := o.split()
|
||||
segmentContainer, segmentObjects, err := o.fs.c.LargeObjectGetSegments(container, objectName)
|
||||
if err != nil {
|
||||
return err
|
||||
fs.Debugf(o, "Failed to get list segments of object: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
except = path.Join(o.remote, except)
|
||||
// fs.Debugf(o, "segmentsContainer %q prefix %q", segmentsContainer, prefix)
|
||||
err = o.fs.listContainerRoot(segmentsContainer, o.remote, "", false, true, true, func(remote string, object *swift.Object, isDirectory bool) error {
|
||||
if isDirectory {
|
||||
return nil
|
||||
var containerSegments = make(map[string][]string)
|
||||
for _, segment := range segmentObjects {
|
||||
if _, ok := containerSegments[segmentContainer]; !ok {
|
||||
containerSegments[segmentContainer] = make([]string, 0, len(segmentObjects))
|
||||
}
|
||||
if except != "" && strings.HasPrefix(remote, except) {
|
||||
// fs.Debugf(o, "Ignoring current segment file %q in container %q", remote, segmentsContainer)
|
||||
return nil
|
||||
}
|
||||
fs.Debugf(o, "Removing segment file %q in container %q", remote, segmentsContainer)
|
||||
var err error
|
||||
return o.fs.pacer.Call(func() (bool, error) {
|
||||
err = o.fs.c.ObjectDelete(segmentsContainer, remote)
|
||||
return shouldRetry(err)
|
||||
})
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
segments, _ := containerSegments[segmentContainer]
|
||||
segments = append(segments, segment.Name)
|
||||
containerSegments[segmentContainer] = segments
|
||||
}
|
||||
// remove the segments container if empty, ignore errors
|
||||
err = o.fs.pacer.Call(func() (bool, error) {
|
||||
err = o.fs.c.ContainerDelete(segmentsContainer)
|
||||
if err == swift.ContainerNotFound || err == swift.ContainerNotEmpty {
|
||||
return false, err
|
||||
return containerSegments, nil
|
||||
}
|
||||
|
||||
func (o *Object) removeSegmentsLargeObject(containerSegments map[string][]string) error {
|
||||
if containerSegments == nil || len(containerSegments) <= 0 {
|
||||
return nil
|
||||
}
|
||||
for container, segments := range containerSegments {
|
||||
_, err := o.fs.c.BulkDelete(container, segments)
|
||||
if err != nil {
|
||||
fs.Debugf(o, "Failed to delete bulk segments %v", err)
|
||||
return err
|
||||
}
|
||||
return shouldRetry(err)
|
||||
})
|
||||
if err == nil {
|
||||
fs.Debugf(o, "Removed empty container %q", segmentsContainer)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1194,7 +1192,7 @@ func urlEncode(str string) string {
|
||||
var buf bytes.Buffer
|
||||
for i := 0; i < len(str); i++ {
|
||||
c := str[i]
|
||||
if (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '/' || c == '.' {
|
||||
if (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '/' || c == '.' || c == '_' || c == '-' {
|
||||
_ = buf.WriteByte(c)
|
||||
} else {
|
||||
_, _ = buf.WriteString(fmt.Sprintf("%%%02X", c))
|
||||
@@ -1234,10 +1232,20 @@ func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64,
|
||||
uniquePrefix := fmt.Sprintf("%s/%d", swift.TimeToFloatString(time.Now()), size)
|
||||
segmentsPath := path.Join(containerPath, uniquePrefix)
|
||||
in := bufio.NewReader(in0)
|
||||
segmentInfos := make([]string, 0, ((size / int64(o.fs.opt.ChunkSize)) + 1))
|
||||
segmentInfos := make([]string, 0, (size/int64(o.fs.opt.ChunkSize))+1)
|
||||
defer atexit.OnError(&err, func() {
|
||||
if o.fs.opt.LeavePartsOnError {
|
||||
return
|
||||
}
|
||||
fs.Debugf(o, "Delete segments when err raise %v", err)
|
||||
if segmentInfos == nil || len(segmentInfos) == 0 {
|
||||
return
|
||||
}
|
||||
deleteChunks(o, segmentsContainer, segmentInfos)
|
||||
})()
|
||||
for {
|
||||
// can we read at least one byte?
|
||||
if _, err := in.Peek(1); err != nil {
|
||||
if _, err = in.Peek(1); err != nil {
|
||||
if left > 0 {
|
||||
return "", err // read less than expected
|
||||
}
|
||||
@@ -1262,8 +1270,6 @@ func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64,
|
||||
return shouldRetryHeaders(rxHeaders, err)
|
||||
})
|
||||
if err != nil {
|
||||
deleteChunks(o, segmentsContainer, segmentInfos)
|
||||
segmentInfos = nil
|
||||
return "", err
|
||||
}
|
||||
i++
|
||||
@@ -1277,21 +1283,23 @@ func (o *Object) updateChunks(in0 io.Reader, headers swift.Headers, size int64,
|
||||
rxHeaders, err = o.fs.c.ObjectPut(container, containerPath, emptyReader, true, "", contentType, headers)
|
||||
return shouldRetryHeaders(rxHeaders, err)
|
||||
})
|
||||
if err != nil {
|
||||
deleteChunks(o, segmentsContainer, segmentInfos)
|
||||
|
||||
if err == nil {
|
||||
//reset data
|
||||
segmentInfos = nil
|
||||
}
|
||||
return uniquePrefix + "/", err
|
||||
}
|
||||
|
||||
func deleteChunks(o *Object, segmentsContainer string, segmentInfos []string) {
|
||||
if segmentInfos != nil && len(segmentInfos) > 0 {
|
||||
for _, v := range segmentInfos {
|
||||
fs.Debugf(o, "Delete segment file %q on %q", v, segmentsContainer)
|
||||
e := o.fs.c.ObjectDelete(segmentsContainer, v)
|
||||
if e != nil {
|
||||
fs.Errorf(o, "Error occurred in delete segment file %q on %q, error: %q", v, segmentsContainer, e)
|
||||
}
|
||||
if segmentInfos == nil || len(segmentInfos) == 0 {
|
||||
return
|
||||
}
|
||||
for _, v := range segmentInfos {
|
||||
fs.Debugf(o, "Delete segment file %q on %q", v, segmentsContainer)
|
||||
e := o.fs.c.ObjectDelete(segmentsContainer, v)
|
||||
if e != nil {
|
||||
fs.Errorf(o, "Error occurred in delete segment file %q on %q, error: %q", v, segmentsContainer, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1312,20 +1320,26 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
modTime := src.ModTime(ctx)
|
||||
|
||||
// Note whether this is a dynamic large object before starting
|
||||
isDynamicLargeObject, err := o.isDynamicLargeObject()
|
||||
isLargeObject, err := o.isLargeObject()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//capture segments before upload
|
||||
var segmentsContainer map[string][]string
|
||||
if isLargeObject {
|
||||
segmentsContainer, _ = o.getSegmentsLargeObject()
|
||||
}
|
||||
|
||||
// Set the mtime
|
||||
m := swift.Metadata{}
|
||||
m.SetModTime(modTime)
|
||||
contentType := fs.MimeType(ctx, src)
|
||||
headers := m.ObjectHeaders()
|
||||
fs.OpenOptionAddHeaders(options, headers)
|
||||
uniquePrefix := ""
|
||||
|
||||
if size > int64(o.fs.opt.ChunkSize) || (size == -1 && !o.fs.opt.NoChunk) {
|
||||
uniquePrefix, err = o.updateChunks(in, headers, size, contentType)
|
||||
_, err = o.updateChunks(in, headers, size, contentType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1359,10 +1373,10 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
|
||||
o.size = int64(inCount.BytesRead())
|
||||
}
|
||||
}
|
||||
|
||||
// If file was a dynamic large object then remove old/all segments
|
||||
if isDynamicLargeObject {
|
||||
err = o.removeSegments(uniquePrefix)
|
||||
isInContainerVersioning, _ := o.isInContainerVersioning(container)
|
||||
// If file was a large object and the container is not enable versioning then remove old/all segments
|
||||
if isLargeObject && len(segmentsContainer) > 0 && !isInContainerVersioning {
|
||||
err := o.removeSegmentsLargeObject(segmentsContainer)
|
||||
if err != nil {
|
||||
fs.Logf(o, "Failed to remove old segments - carrying on with upload: %v", err)
|
||||
}
|
||||
@@ -1389,15 +1403,10 @@ func (o *Object) Remove(ctx context.Context) (err error) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
isStaticLargeObject, err := o.isStaticLargeObject()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var segmentContainer string
|
||||
var segmentObjects []swift.Object
|
||||
|
||||
if isStaticLargeObject {
|
||||
segmentContainer, segmentObjects, err = o.fs.c.LargeObjectGetSegments(container, containerPath)
|
||||
//capture segments object if this object is large object
|
||||
var containerSegments map[string][]string
|
||||
if isLargeObject {
|
||||
containerSegments, err = o.getSegmentsLargeObject()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1415,31 +1424,9 @@ func (o *Object) Remove(ctx context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
isDynamicLargeObject, err := o.isDynamicLargeObject()
|
||||
if err != nil {
|
||||
return err
|
||||
if isLargeObject {
|
||||
return o.removeSegmentsLargeObject(containerSegments)
|
||||
}
|
||||
// ...then segments if required
|
||||
//delete segment for dynamic large object
|
||||
if isDynamicLargeObject {
|
||||
return o.removeSegments("")
|
||||
}
|
||||
|
||||
//delete segment for static large object
|
||||
if isStaticLargeObject && len(segmentContainer) > 0 && segmentObjects != nil && len(segmentObjects) > 0 {
|
||||
var segmentNames []string
|
||||
for _, segmentObject := range segmentObjects {
|
||||
if len(segmentObject.Name) == 0 {
|
||||
continue
|
||||
}
|
||||
segmentNames = append(segmentNames, segmentObject.Name)
|
||||
}
|
||||
_, err := o.fs.c.BulkDelete(segmentContainer, segmentNames)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,19 @@ package swift
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"github.com/ncw/swift"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/hash"
|
||||
"github.com/rclone/rclone/fs/object"
|
||||
"github.com/rclone/rclone/fstest"
|
||||
"github.com/rclone/rclone/fstest/fstests"
|
||||
"github.com/rclone/rclone/lib/random"
|
||||
"github.com/rclone/rclone/lib/readers"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -74,6 +78,80 @@ func (f *Fs) testNoChunk(t *testing.T) {
|
||||
// Additional tests that aren't in the framework
|
||||
func (f *Fs) InternalTest(t *testing.T) {
|
||||
t.Run("NoChunk", f.testNoChunk)
|
||||
t.Run("WithChunk", f.testWithChunk)
|
||||
t.Run("WithChunkFail", f.testWithChunkFail)
|
||||
}
|
||||
|
||||
func (f *Fs) testWithChunk(t *testing.T) {
|
||||
preConfChunkSize := f.opt.ChunkSize
|
||||
preConfChunk := f.opt.NoChunk
|
||||
f.opt.NoChunk = false
|
||||
f.opt.ChunkSize = 1024 * fs.Byte
|
||||
defer func() {
|
||||
//restore old config after test
|
||||
f.opt.ChunkSize = preConfChunkSize
|
||||
f.opt.NoChunk = preConfChunk
|
||||
}()
|
||||
|
||||
file := fstest.Item{
|
||||
ModTime: fstest.Time("2020-12-31T04:05:06.499999999Z"),
|
||||
Path: "piped data chunk.txt",
|
||||
Size: -1, // use unknown size during upload
|
||||
}
|
||||
const contentSize = 2048
|
||||
contents := random.String(contentSize)
|
||||
buf := bytes.NewBufferString(contents)
|
||||
uploadHash := hash.NewMultiHasher()
|
||||
in := io.TeeReader(buf, uploadHash)
|
||||
|
||||
file.Size = -1
|
||||
obji := object.NewStaticObjectInfo(file.Path, file.ModTime, file.Size, true, nil, nil)
|
||||
ctx := context.TODO()
|
||||
obj, err := f.Features().PutStream(ctx, in, obji)
|
||||
require.NoError(t, err)
|
||||
require.NotEmpty(t, obj)
|
||||
}
|
||||
|
||||
func (f *Fs) testWithChunkFail(t *testing.T) {
|
||||
preConfChunkSize := f.opt.ChunkSize
|
||||
preConfChunk := f.opt.NoChunk
|
||||
f.opt.NoChunk = false
|
||||
f.opt.ChunkSize = 1024 * fs.Byte
|
||||
segmentContainer := f.root + "_segments"
|
||||
defer func() {
|
||||
//restore config
|
||||
f.opt.ChunkSize = preConfChunkSize
|
||||
f.opt.NoChunk = preConfChunk
|
||||
}()
|
||||
path := "piped data chunk with error.txt"
|
||||
file := fstest.Item{
|
||||
ModTime: fstest.Time("2021-01-04T03:46:00.499999999Z"),
|
||||
Path: path,
|
||||
Size: -1, // use unknown size during upload
|
||||
}
|
||||
const contentSize = 4096
|
||||
const errPosition = 3072
|
||||
contents := random.String(contentSize)
|
||||
buf := bytes.NewBufferString(contents[:errPosition])
|
||||
errMessage := "potato"
|
||||
er := &readers.ErrorReader{Err: errors.New(errMessage)}
|
||||
in := ioutil.NopCloser(io.MultiReader(buf, er))
|
||||
|
||||
file.Size = contentSize
|
||||
obji := object.NewStaticObjectInfo(file.Path, file.ModTime, file.Size, true, nil, nil)
|
||||
ctx := context.TODO()
|
||||
_, err := f.Features().PutStream(ctx, in, obji)
|
||||
// error is potato
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, errMessage, err.Error())
|
||||
_, _, err = f.c.Object(f.rootContainer, path)
|
||||
assert.Equal(t, swift.ObjectNotFound, err)
|
||||
prefix := path
|
||||
objs, err := f.c.Objects(segmentContainer, &swift.ObjectsOpts{
|
||||
Prefix: prefix,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, objs)
|
||||
}
|
||||
|
||||
var _ fstests.InternalTester = (*Fs)(nil)
|
||||
+7
-5
@@ -6,6 +6,7 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/fs/config/flags"
|
||||
@@ -35,7 +36,8 @@ func init() {
|
||||
var commandDefinition = &cobra.Command{
|
||||
Use: "cat remote:path",
|
||||
Short: `Concatenates any files and sends them to stdout.`,
|
||||
Long: `
|
||||
// Warning! "|" will be replaced by backticks below
|
||||
Long: strings.ReplaceAll(`
|
||||
rclone cat sends any files to standard output.
|
||||
|
||||
You can use it like this to output a single file
|
||||
@@ -50,11 +52,11 @@ Or like this to output any .txt files in dir or its subdirectories.
|
||||
|
||||
rclone --include "*.txt" cat remote:path/to/dir
|
||||
|
||||
Use the --head flag to print characters only at the start, --tail for
|
||||
the end and --offset and --count to print a section in the middle.
|
||||
Use the |--head| flag to print characters only at the start, |--tail| for
|
||||
the end and |--offset| and |--count| to print a section in the middle.
|
||||
Note that if offset is negative it will count from the end, so
|
||||
--offset -1 --count 1 is equivalent to --tail 1.
|
||||
`,
|
||||
|--offset -1 --count 1| is equivalent to |--tail 1|.
|
||||
`, "|", "`"),
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
usedOffset := offset != 0 || count >= 0
|
||||
usedHead := head > 0
|
||||
|
||||
+7
-6
@@ -45,7 +45,8 @@ func AddFlags(cmdFlags *pflag.FlagSet) {
|
||||
}
|
||||
|
||||
// FlagsHelp describes the flags for the help
|
||||
var FlagsHelp = strings.Replace(`
|
||||
// Warning! "|" will be replaced by backticks below
|
||||
var FlagsHelp = strings.ReplaceAll(`
|
||||
If you supply the |--one-way| flag, it will only check that files in
|
||||
the source match the files in the destination, not the other way
|
||||
around. This means that extra files in the destination that are not in
|
||||
@@ -66,7 +67,7 @@ you what happened to it. These are reminiscent of diff files.
|
||||
- |+ path| means path was missing on the destination, so only in the source
|
||||
- |* path| means path was present in source and destination but different.
|
||||
- |! path| means there was an error reading or hashing the source or dest.
|
||||
`, "|", "`", -1)
|
||||
`, "|", "`")
|
||||
|
||||
// GetCheckOpt gets the options corresponding to the check flags
|
||||
func GetCheckOpt(fsrc, fdst fs.Fs) (opt *operations.CheckOpt, close func(), err error) {
|
||||
@@ -130,19 +131,19 @@ func GetCheckOpt(fsrc, fdst fs.Fs) (opt *operations.CheckOpt, close func(), err
|
||||
var commandDefinition = &cobra.Command{
|
||||
Use: "check source:path dest:path",
|
||||
Short: `Checks the files in the source and destination match.`,
|
||||
Long: `
|
||||
Long: strings.ReplaceAll(`
|
||||
Checks the files in the source and destination match. It compares
|
||||
sizes and hashes (MD5 or SHA1) and logs a report of files which don't
|
||||
match. It doesn't alter the source or destination.
|
||||
|
||||
If you supply the --size-only flag, it will only compare the sizes not
|
||||
If you supply the |--size-only| flag, it will only compare the sizes not
|
||||
the hashes as well. Use this for a quick check.
|
||||
|
||||
If you supply the --download flag, it will download the data from
|
||||
If you supply the |--download| flag, it will download the data from
|
||||
both remotes and check them against each other on the fly. This can
|
||||
be useful for remotes that don't support hashes or if you really want
|
||||
to check all the data.
|
||||
` + FlagsHelp,
|
||||
`, "|", "`") + FlagsHelp,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 2, command, args)
|
||||
fsrc, fdst := cmd.NewFsSrcDst(args)
|
||||
|
||||
@@ -382,6 +382,11 @@ func initConfig() {
|
||||
// Finish parsing any command line flags
|
||||
configflags.SetFlags(ci)
|
||||
|
||||
// Hide console window
|
||||
if ci.NoConsole {
|
||||
terminal.HideConsole()
|
||||
}
|
||||
|
||||
// Load filters
|
||||
err := filterflags.Reload(ctx)
|
||||
if err != nil {
|
||||
|
||||
+8
-5
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/billziss-gh/cgofuse/fuse"
|
||||
@@ -23,11 +24,12 @@ const fhUnset = ^uint64(0)
|
||||
|
||||
// FS represents the top level filing system
|
||||
type FS struct {
|
||||
VFS *vfs.VFS
|
||||
f fs.Fs
|
||||
ready chan (struct{})
|
||||
mu sync.Mutex // to protect the below
|
||||
handles []vfs.Handle
|
||||
VFS *vfs.VFS
|
||||
f fs.Fs
|
||||
ready chan (struct{})
|
||||
mu sync.Mutex // to protect the below
|
||||
handles []vfs.Handle
|
||||
destroyed int32 // read/write with sync/atomic
|
||||
}
|
||||
|
||||
// NewFS makes a new FS
|
||||
@@ -187,6 +189,7 @@ func (fsys *FS) Init() {
|
||||
// Destroy call).
|
||||
func (fsys *FS) Destroy() {
|
||||
defer log.Trace(fsys.f, "")("")
|
||||
atomic.StoreInt32(&fsys.destroyed, 1)
|
||||
}
|
||||
|
||||
// Getattr reads the attributes for path
|
||||
|
||||
+5
-1
@@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/billziss-gh/cgofuse/fuse"
|
||||
@@ -168,7 +169,10 @@ func mount(VFS *vfs.VFS, mountPath string, opt *mountlib.Options) (<-chan error,
|
||||
// Shutdown the VFS
|
||||
fsys.VFS.Shutdown()
|
||||
var umountOK bool
|
||||
if atexit.Signalled() {
|
||||
if atomic.LoadInt32(&fsys.destroyed) != 0 {
|
||||
fs.Debugf(nil, "Not calling host.Unmount as mount already Destroyed")
|
||||
umountOK = true
|
||||
} else if atexit.Signalled() {
|
||||
// If we have received a signal then FUSE will be shutting down already
|
||||
fs.Debugf(nil, "Not calling host.Unmount as signal received")
|
||||
umountOK = true
|
||||
|
||||
+8
-6
@@ -2,6 +2,7 @@ package copy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/fs/config/flags"
|
||||
@@ -23,7 +24,8 @@ func init() {
|
||||
var commandDefinition = &cobra.Command{
|
||||
Use: "copy source:path dest:path",
|
||||
Short: `Copy files from source to dest, skipping already copied.`,
|
||||
Long: `
|
||||
// Note: "|" will be replaced by backticks below
|
||||
Long: strings.ReplaceAll(`
|
||||
Copy the source to the destination. Doesn't transfer
|
||||
unchanged files, testing by size and modification time or
|
||||
MD5SUM. Doesn't delete files from the destination.
|
||||
@@ -55,8 +57,8 @@ Not to
|
||||
destpath/sourcepath/one.txt
|
||||
destpath/sourcepath/two.txt
|
||||
|
||||
If you are familiar with ` + "`rsync`" + `, rclone always works as if you had
|
||||
written a trailing / - meaning "copy the contents of this directory".
|
||||
If you are familiar with |rsync|, rclone always works as if you had
|
||||
written a trailing |/| - meaning "copy the contents of this directory".
|
||||
This applies to all commands and whether you are talking about the
|
||||
source or destination.
|
||||
|
||||
@@ -71,10 +73,10 @@ recently very efficiently like this:
|
||||
|
||||
rclone copy --max-age 24h --no-traverse /path/to/src remote:
|
||||
|
||||
**Note**: Use the ` + "`-P`" + `/` + "`--progress`" + ` flag to view real-time transfer statistics.
|
||||
**Note**: Use the |-P|/|--progress| flag to view real-time transfer statistics.
|
||||
|
||||
**Note**: Use the ` + "`--dry-run` or the `--interactive`/`-i`" + ` flag to test without copying anything.
|
||||
`,
|
||||
**Note**: Use the |--dry-run| or the |--interactive|/|-i| flag to test without copying anything.
|
||||
`, "|", "`"),
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 2, command, args)
|
||||
fsrc, srcFileName, fdst := cmd.NewFsSrcFileDst(args)
|
||||
|
||||
@@ -36,6 +36,9 @@ use it like this
|
||||
rclone cryptdecode encryptedremote: encryptedfilename1 encryptedfilename2
|
||||
|
||||
rclone cryptdecode --reverse encryptedremote: filename1 filename2
|
||||
|
||||
Another way to accomplish this is by using the ` + "`rclone backend encode` (or `decode`)" + `command.
|
||||
See the documentation on the ` + "`crypt`" + ` overlay for more info.
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 11, command, args)
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/fs"
|
||||
"github.com/rclone/rclone/fs/config/flags"
|
||||
"github.com/rclone/rclone/fs/operations"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -143,6 +144,9 @@ Or
|
||||
args = args[1:]
|
||||
}
|
||||
fdst := cmd.NewFsSrc(args)
|
||||
if !byHash && !fdst.Features().DuplicateFiles {
|
||||
fs.Logf(fdst, "Can't have duplicate names here. Perhaps you wanted --by-hash ? Continuing anyway.")
|
||||
}
|
||||
cmd.Run(false, false, command, func() error {
|
||||
return operations.Deduplicate(context.Background(), fdst, dedupeMode, byHash)
|
||||
})
|
||||
|
||||
+10
-8
@@ -2,6 +2,7 @@ package delete
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/fs/config/flags"
|
||||
@@ -22,16 +23,17 @@ func init() {
|
||||
var commandDefinition = &cobra.Command{
|
||||
Use: "delete remote:path",
|
||||
Short: `Remove the files in path.`,
|
||||
Long: `
|
||||
Remove the files in path. Unlike ` + "`" + `purge` + "`" + ` it obeys include/exclude
|
||||
// Warning! "|" will be replaced by backticks below
|
||||
Long: strings.ReplaceAll(`
|
||||
Remove the files in path. Unlike |purge| it obeys include/exclude
|
||||
filters so can be used to selectively delete files.
|
||||
|
||||
` + "`rclone delete`" + ` only deletes files but leaves the directory structure
|
||||
|rclone delete| only deletes files but leaves the directory structure
|
||||
alone. If you want to delete a directory and all of its contents use
|
||||
the ` + "`purge`" + ` command.
|
||||
the |purge| command.
|
||||
|
||||
If you supply the --rmdirs flag, it will remove all empty directories along with it.
|
||||
You can also use the separate command ` + "`rmdir`" + ` or ` + "`rmdirs`" + ` to
|
||||
If you supply the |--rmdirs| flag, it will remove all empty directories along with it.
|
||||
You can also use the separate command |rmdir| or |rmdirs| to
|
||||
delete empty directories only.
|
||||
|
||||
For example, to delete all files bigger than 100MBytes, you may first want to check what
|
||||
@@ -48,8 +50,8 @@ That reads "delete everything with a minimum size of 100 MB", hence
|
||||
delete all files bigger than 100MBytes.
|
||||
|
||||
**Important**: Since this can cause data loss, test first with the
|
||||
` + "`--dry-run` or the `--interactive`/`-i`" + ` flag.
|
||||
`,
|
||||
|--dry-run| or the |--interactive|/|-i| flag.
|
||||
`, "|", "`"),
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
fsrc := cmd.NewFsSrc(args)
|
||||
|
||||
+17
-12
@@ -1,26 +1,31 @@
|
||||
package lshelp
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Help describes the common help for all the list commands
|
||||
var Help = `
|
||||
// Warning! "|" will be replaced by backticks below
|
||||
var Help = strings.ReplaceAll(`
|
||||
Any of the filtering options can be applied to this command.
|
||||
|
||||
There are several related list commands
|
||||
|
||||
* ` + "`ls`" + ` to list size and path of objects only
|
||||
* ` + "`lsl`" + ` to list modification time, size and path of objects only
|
||||
* ` + "`lsd`" + ` to list directories only
|
||||
* ` + "`lsf`" + ` to list objects and directories in easy to parse format
|
||||
* ` + "`lsjson`" + ` to list objects and directories in JSON format
|
||||
* |ls| to list size and path of objects only
|
||||
* |lsl| to list modification time, size and path of objects only
|
||||
* |lsd| to list directories only
|
||||
* |lsf| to list objects and directories in easy to parse format
|
||||
* |lsjson| to list objects and directories in JSON format
|
||||
|
||||
` + "`ls`,`lsl`,`lsd`" + ` are designed to be human readable.
|
||||
` + "`lsf`" + ` is designed to be human and machine readable.
|
||||
` + "`lsjson`" + ` is designed to be machine readable.
|
||||
|ls|,|lsl|,|lsd| are designed to be human readable.
|
||||
|lsf| is designed to be human and machine readable.
|
||||
|lsjson| is designed to be machine readable.
|
||||
|
||||
Note that ` + "`ls` and `lsl`" + ` recurse by default - use "--max-depth 1" to stop the recursion.
|
||||
Note that |ls| and |lsl| recurse by default - use |--max-depth 1| to stop the recursion.
|
||||
|
||||
The other list commands ` + "`lsd`,`lsf`,`lsjson`" + ` do not recurse by default - use "-R" to make them recurse.
|
||||
The other list commands |lsd|,|lsf|,|lsjson| do not recurse by default - use |-R| to make them recurse.
|
||||
|
||||
Listing a non existent directory will produce an error except for
|
||||
remotes which can't have empty directories (e.g. s3, swift, or gcs -
|
||||
the bucket based remotes).
|
||||
`
|
||||
`, "|", "`")
|
||||
+66
-64
@@ -159,34 +159,36 @@ func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Comm
|
||||
Use: commandName + " remote:path /path/to/mountpoint",
|
||||
Hidden: hidden,
|
||||
Short: `Mount the remote as file system on a mountpoint.`,
|
||||
Long: `
|
||||
rclone ` + commandName + ` allows Linux, FreeBSD, macOS and Windows to
|
||||
// Warning! "|" will be replaced by backticks below
|
||||
// "@" will be replaced by the command name
|
||||
Long: strings.ReplaceAll(strings.ReplaceAll(`
|
||||
rclone @ allows Linux, FreeBSD, macOS and Windows to
|
||||
mount any of Rclone's cloud storage systems as a file system with
|
||||
FUSE.
|
||||
|
||||
First set up your remote using ` + "`rclone config`" + `. Check it works with ` + "`rclone ls`" + ` etc.
|
||||
First set up your remote using |rclone config|. Check it works with |rclone ls| etc.
|
||||
|
||||
On Linux and OSX, you can either run mount in foreground mode or background (daemon) mode.
|
||||
Mount runs in foreground mode by default, use the ` + "`--daemon`" + ` flag to specify background mode.
|
||||
Mount runs in foreground mode by default, use the |--daemon| flag to specify background mode.
|
||||
You can only run mount in foreground mode on Windows.
|
||||
|
||||
On Linux/macOS/FreeBSD start the mount like this, where ` + "`/path/to/local/mount`" + `
|
||||
On Linux/macOS/FreeBSD start the mount like this, where |/path/to/local/mount|
|
||||
is an **empty** **existing** directory:
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files /path/to/local/mount
|
||||
rclone @ remote:path/to/files /path/to/local/mount
|
||||
|
||||
On Windows you can start a mount in different ways. See [below](#mounting-modes-on-windows)
|
||||
for details. The following examples will mount to an automatically assigned drive,
|
||||
to specific drive letter ` + "`X:`" + `, to path ` + "`C:\\path\\to\\nonexistent\\directory`" + `
|
||||
to specific drive letter |X:|, to path |C:\path\to\nonexistent\directory|
|
||||
(which must be **non-existent** subdirectory of an **existing** parent directory or drive,
|
||||
and is not supported when [mounting as a network drive](#mounting-modes-on-windows)), and
|
||||
the last example will mount as network share ` + "`\\cloud\remote`" + ` and map it to an
|
||||
the last example will mount as network share |\\cloud\remote| and map it to an
|
||||
automatically assigned drive:
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files *
|
||||
rclone ` + commandName + ` remote:path/to/files X:
|
||||
rclone ` + commandName + ` remote:path/to/files C:\path\to\nonexistent\directory
|
||||
rclone ` + commandName + ` remote:path/to/files \\cloud\remote
|
||||
rclone @ remote:path/to/files *
|
||||
rclone @ remote:path/to/files X:
|
||||
rclone @ remote:path/to/files C:\path\to\nonexistent\directory
|
||||
rclone @ remote:path/to/files \\cloud\remote
|
||||
|
||||
When the program ends while in foreground mode, either via Ctrl+C or receiving
|
||||
a SIGINT or SIGTERM signal, the mount should be automatically stopped.
|
||||
@@ -208,12 +210,12 @@ then an additional 1PB of free space is assumed. If the remote does not
|
||||
[support](https://rclone.org/overview/#optional-features) the about feature
|
||||
at all, then 1PB is set as both the total and the free size.
|
||||
|
||||
**Note**: As of ` + "`rclone` 1.52.2, `rclone mount`" + ` now requires Go version 1.13
|
||||
**Note**: As of |rclone| 1.52.2, |rclone mount| now requires Go version 1.13
|
||||
or newer on some platforms depending on the underlying FUSE library in use.
|
||||
|
||||
### Installing on Windows
|
||||
|
||||
To run rclone ` + commandName + ` on Windows, you will need to
|
||||
To run rclone @ on Windows, you will need to
|
||||
download and install [WinFsp](http://www.secfs.net/winfsp/).
|
||||
|
||||
[WinFsp](https://github.com/billziss-gh/winfsp) is an open source
|
||||
@@ -221,7 +223,7 @@ Windows File System Proxy which makes it easy to write user space file
|
||||
systems for Windows. It provides a FUSE emulation layer which rclone
|
||||
uses combination with [cgofuse](https://github.com/billziss-gh/cgofuse).
|
||||
Both of these packages are by Bill Zissimopoulos who was very helpful
|
||||
during the implementation of rclone ` + commandName + ` for Windows.
|
||||
during the implementation of rclone @ for Windows.
|
||||
|
||||
#### Mounting modes on windows
|
||||
|
||||
@@ -240,54 +242,54 @@ as a network drive instead.
|
||||
|
||||
When mounting as a fixed disk drive you can either mount to an unused drive letter,
|
||||
or to a path - which must be **non-existent** subdirectory of an **existing** parent
|
||||
directory or drive. Using the special value ` + "`*`" + ` will tell rclone to
|
||||
directory or drive. Using the special value |*| will tell rclone to
|
||||
automatically assign the next available drive letter, starting with Z: and moving backward.
|
||||
Examples:
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files *
|
||||
rclone ` + commandName + ` remote:path/to/files X:
|
||||
rclone ` + commandName + ` remote:path/to/files C:\path\to\nonexistent\directory
|
||||
rclone ` + commandName + ` remote:path/to/files X:
|
||||
rclone @ remote:path/to/files *
|
||||
rclone @ remote:path/to/files X:
|
||||
rclone @ remote:path/to/files C:\path\to\nonexistent\directory
|
||||
rclone @ remote:path/to/files X:
|
||||
|
||||
Option ` + "`--volname`" + ` can be used to set a custom volume name for the mounted
|
||||
Option |--volname| can be used to set a custom volume name for the mounted
|
||||
file system. The default is to use the remote name and path.
|
||||
|
||||
To mount as network drive, you can add option ` + "`--network-mode`" + `
|
||||
to your ` + commandName + ` command. Mounting to a directory path is not supported in
|
||||
To mount as network drive, you can add option |--network-mode|
|
||||
to your @ command. Mounting to a directory path is not supported in
|
||||
this mode, it is a limitation Windows imposes on junctions, so the remote must always
|
||||
be mounted to a drive letter.
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files X: --network-mode
|
||||
rclone @ remote:path/to/files X: --network-mode
|
||||
|
||||
A volume name specified with ` + "`--volname`" + ` will be used to create the network share path.
|
||||
A complete UNC path, such as ` + "`\\\\cloud\\remote`" + `, optionally with path
|
||||
` + "`\\\\cloud\\remote\\madeup\\path`" + `, will be used as is. Any other
|
||||
string will be used as the share part, after a default prefix ` + "`\\\\server\\`" + `.
|
||||
If no volume name is specified then ` + "`\\\\server\\share`" + ` will be used.
|
||||
A volume name specified with |--volname| will be used to create the network share path.
|
||||
A complete UNC path, such as |\\cloud\remote|, optionally with path
|
||||
|\\cloud\remote\madeup\path|, will be used as is. Any other
|
||||
string will be used as the share part, after a default prefix |\\server\|.
|
||||
If no volume name is specified then |\\server\share| will be used.
|
||||
You must make sure the volume name is unique when you are mounting more than one drive,
|
||||
or else the mount command will fail. The share name will treated as the volume label for
|
||||
the mapped drive, shown in Windows Explorer etc, while the complete
|
||||
` + "`\\\\server\\share`" + ` will be reported as the remote UNC path by
|
||||
` + "`net use`" + ` etc, just like a normal network drive mapping.
|
||||
|\\server\share| will be reported as the remote UNC path by
|
||||
|net use| etc, just like a normal network drive mapping.
|
||||
|
||||
If you specify a full network share UNC path with ` + "`--volname`" + `, this will implicitely
|
||||
set the ` + "`--network-mode`" + ` option, so the following two examples have same result:
|
||||
If you specify a full network share UNC path with |--volname|, this will implicitely
|
||||
set the |--network-mode| option, so the following two examples have same result:
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files X: --network-mode
|
||||
rclone ` + commandName + ` remote:path/to/files X: --volname \\server\share
|
||||
rclone @ remote:path/to/files X: --network-mode
|
||||
rclone @ remote:path/to/files X: --volname \\server\share
|
||||
|
||||
You may also specify the network share UNC path as the mountpoint itself. Then rclone
|
||||
will automatically assign a drive letter, same as with ` + "`*`" + ` and use that as
|
||||
will automatically assign a drive letter, same as with |*| and use that as
|
||||
mountpoint, and instead use the UNC path specified as the volume name, as if it were
|
||||
specified with the ` + "`--volname`" + ` option. This will also implicitely set
|
||||
the ` + "`--network-mode`" + ` option. This means the following two examples have same result:
|
||||
specified with the |--volname| option. This will also implicitely set
|
||||
the |--network-mode| option. This means the following two examples have same result:
|
||||
|
||||
rclone ` + commandName + ` remote:path/to/files \\cloud\remote
|
||||
rclone ` + commandName + ` remote:path/to/files * --volname \\cloud\remote
|
||||
rclone @ remote:path/to/files \\cloud\remote
|
||||
rclone @ remote:path/to/files * --volname \\cloud\remote
|
||||
|
||||
There is yet another way to enable network mode, and to set the share path,
|
||||
and that is to pass the "native" libfuse/WinFsp option directly:
|
||||
` + "`--fuse-flag --VolumePrefix=\\server\\share`" + `. Note that the path
|
||||
|--fuse-flag --VolumePrefix=\server\share|. Note that the path
|
||||
must be with just a single backslash prefix in this case.
|
||||
|
||||
|
||||
@@ -308,12 +310,12 @@ representing permissions for the POSIX permission scopes: Owner, group and other
|
||||
By default, the owner and group will be taken from the current user, and the built-in
|
||||
group "Everyone" will be used to represent others. The user/group can be customized
|
||||
with FUSE options "UserName" and "GroupName",
|
||||
e.g. ` + "`-o UserName=user123 -o GroupName=\"Authenticated Users\"`" + `.
|
||||
e.g. |-o UserName=user123 -o GroupName="Authenticated Users"|.
|
||||
|
||||
The permissions on each entry will be set according to
|
||||
[options](#options) ` + "`--dir-perms`" + ` and ` + "`--file-perms`" + `,
|
||||
[options](#options) |--dir-perms| and |--file-perms|,
|
||||
which takes a value in traditional [numeric notation](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation),
|
||||
where the default corresponds to ` + "`--file-perms 0666 --dir-perms 0777`" + `.
|
||||
where the default corresponds to |--file-perms 0666 --dir-perms 0777|.
|
||||
|
||||
Note that the mapping of permissions is not always trivial, and the result
|
||||
you see in Windows Explorer may not be exactly like you expected.
|
||||
@@ -342,10 +344,10 @@ alternatively using [the nssm service manager](https://nssm.cc/usage).
|
||||
|
||||
### Limitations
|
||||
|
||||
Without the use of ` + "`--vfs-cache-mode`" + ` this can only write files
|
||||
Without the use of |--vfs-cache-mode| this can only write files
|
||||
sequentially, it can only seek when reading. This means that many
|
||||
applications won't work with their files on an rclone mount without
|
||||
` + "`--vfs-cache-mode writes`" + ` or ` + "`--vfs-cache-mode full`" + `.
|
||||
|--vfs-cache-mode writes| or |--vfs-cache-mode full|.
|
||||
See the [File Caching](#file-caching) section for more info.
|
||||
|
||||
The bucket based remotes (e.g. Swift, S3, Google Compute Storage, B2,
|
||||
@@ -355,21 +357,21 @@ the directory cache.
|
||||
|
||||
Only supported on Linux, FreeBSD, OS X and Windows at the moment.
|
||||
|
||||
### rclone ` + commandName + ` vs rclone sync/copy
|
||||
### rclone @ vs rclone sync/copy
|
||||
|
||||
File systems expect things to be 100% reliable, whereas cloud storage
|
||||
systems are a long way from 100% reliable. The rclone sync/copy
|
||||
commands cope with this with lots of retries. However rclone ` + commandName + `
|
||||
commands cope with this with lots of retries. However rclone @
|
||||
can't use retries in the same way without making local copies of the
|
||||
uploads. Look at the [file caching](#file-caching)
|
||||
for solutions to make ` + commandName + ` more reliable.
|
||||
for solutions to make @ more reliable.
|
||||
|
||||
### Attribute caching
|
||||
|
||||
You can use the flag ` + "`--attr-timeout`" + ` to set the time the kernel caches
|
||||
You can use the flag |--attr-timeout| to set the time the kernel caches
|
||||
the attributes (size, modification time, etc.) for directory entries.
|
||||
|
||||
The default is "1s" which caches files just long enough to avoid
|
||||
The default is |1s| which caches files just long enough to avoid
|
||||
too many callbacks to rclone from the kernel.
|
||||
|
||||
In theory 0s should be the correct value for filesystems which can
|
||||
@@ -380,14 +382,14 @@ few problems such as
|
||||
and [excessive time listing directories](https://github.com/rclone/rclone/issues/2095#issuecomment-371141147).
|
||||
|
||||
The kernel can cache the info about a file for the time given by
|
||||
` + "`--attr-timeout`" + `. You may see corruption if the remote file changes
|
||||
|--attr-timeout|. You may see corruption if the remote file changes
|
||||
length during this window. It will show up as either a truncated file
|
||||
or a file with garbage on the end. With ` + "`--attr-timeout 1s`" + ` this is
|
||||
very unlikely but not impossible. The higher you set ` + "`--attr-timeout`" + `
|
||||
or a file with garbage on the end. With |--attr-timeout 1s| this is
|
||||
very unlikely but not impossible. The higher you set |--attr-timeout|
|
||||
the more likely it is. The default setting of "1s" is the lowest
|
||||
setting which mitigates the problems above.
|
||||
|
||||
If you set it higher ('10s' or '1m' say) then the kernel will call
|
||||
If you set it higher (|10s| or |1m| say) then the kernel will call
|
||||
back to rclone less often making it more efficient, however there is
|
||||
more chance of the corruption issue above.
|
||||
|
||||
@@ -403,28 +405,28 @@ files to be visible in the mount.
|
||||
|
||||
### systemd
|
||||
|
||||
When running rclone ` + commandName + ` as a systemd service, it is possible
|
||||
When running rclone @ as a systemd service, it is possible
|
||||
to use Type=notify. In this case the service will enter the started state
|
||||
after the mountpoint has been successfully set up.
|
||||
Units having the rclone ` + commandName + ` service specified as a requirement
|
||||
Units having the rclone @ service specified as a requirement
|
||||
will see all files and folders immediately in this mode.
|
||||
|
||||
### chunked reading
|
||||
|
||||
` + "`--vfs-read-chunk-size`" + ` will enable reading the source objects in parts.
|
||||
|--vfs-read-chunk-size| will enable reading the source objects in parts.
|
||||
This can reduce the used download quota for some remotes by requesting only chunks
|
||||
from the remote that are actually read at the cost of an increased number of requests.
|
||||
|
||||
When ` + "`--vfs-read-chunk-size-limit`" + ` is also specified and greater than
|
||||
` + "`--vfs-read-chunk-size`" + `, the chunk size for each open file will get doubled
|
||||
for each chunk read, until the specified value is reached. A value of -1 will disable
|
||||
When |--vfs-read-chunk-size-limit| is also specified and greater than
|
||||
|--vfs-read-chunk-size|, the chunk size for each open file will get doubled
|
||||
for each chunk read, until the specified value is reached. A value of |-1| will disable
|
||||
the limit and the chunk size will grow indefinitely.
|
||||
|
||||
With ` + "`--vfs-read-chunk-size 100M`" + ` and ` + "`--vfs-read-chunk-size-limit 0`" + `
|
||||
With |--vfs-read-chunk-size 100M| and |--vfs-read-chunk-size-limit 0|
|
||||
the following parts will be downloaded: 0-100M, 100M-200M, 200M-300M, 300M-400M and so on.
|
||||
When ` + "`--vfs-read-chunk-size-limit 500M`" + ` is specified, the result would be
|
||||
When |--vfs-read-chunk-size-limit 500M| is specified, the result would be
|
||||
0-100M, 100M-300M, 300M-700M, 700M-1200M, 1200M-1700M and so on.
|
||||
` + vfs.Help,
|
||||
`, "|", "`"), "@", commandName) + vfs.Help,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 2, command, args)
|
||||
opt := Opt // make a copy of the options
|
||||
|
||||
+11
-9
@@ -2,6 +2,7 @@ package move
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/rclone/rclone/cmd"
|
||||
"github.com/rclone/rclone/fs/config/flags"
|
||||
@@ -26,20 +27,21 @@ func init() {
|
||||
var commandDefinition = &cobra.Command{
|
||||
Use: "move source:path dest:path",
|
||||
Short: `Move files from source to dest.`,
|
||||
Long: `
|
||||
// Warning! "|" will be replaced by backticks below
|
||||
Long: strings.ReplaceAll(`
|
||||
Moves the contents of the source directory to the destination
|
||||
directory. Rclone will error if the source and destination overlap and
|
||||
the remote does not support a server-side directory move operation.
|
||||
|
||||
If no filters are in use and if possible this will server-side move
|
||||
` + "`source:path`" + ` into ` + "`dest:path`" + `. After this ` + "`source:path`" + ` will no
|
||||
|source:path| into |dest:path|. After this |source:path| will no
|
||||
longer exist.
|
||||
|
||||
Otherwise for each file in ` + "`source:path`" + ` selected by the filters (if
|
||||
any) this will move it into ` + "`dest:path`" + `. If possible a server-side
|
||||
Otherwise for each file in |source:path| selected by the filters (if
|
||||
any) this will move it into |dest:path|. If possible a server-side
|
||||
move will be used, otherwise it will copy it (server-side if possible)
|
||||
into ` + "`dest:path`" + ` then delete the original (if no errors on copy) in
|
||||
` + "`source:path`" + `.
|
||||
into |dest:path| then delete the original (if no errors on copy) in
|
||||
|source:path|.
|
||||
|
||||
If you want to delete empty source directories after move, use the --delete-empty-src-dirs flag.
|
||||
|
||||
@@ -49,10 +51,10 @@ option when moving a small number of files into a large destination
|
||||
can speed transfers up greatly.
|
||||
|
||||
**Important**: Since this can cause data loss, test first with the
|
||||
` + "`--dry-run` or the `--interactive`/`-i`" + ` flag.
|
||||
|--dry-run| or the |--interactive|/|-i| flag.
|
||||
|
||||
**Note**: Use the ` + "`-P`" + `/` + "`--progress`" + ` flag to view real-time transfer statistics.
|
||||
`,
|
||||
**Note**: Use the |-P|/|--progress| flag to view real-time transfer statistics.
|
||||
`, "|", "`"),
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 2, command, args)
|
||||
fsrc, srcFileName, fdst := cmd.NewFsSrcFileDst(args)
|
||||
|
||||
+12
-5
@@ -1,9 +1,9 @@
|
||||
package obscure
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/rclone/rclone/cmd"
|
||||
@@ -30,7 +30,8 @@ the config file. However it is very hard to shoulder surf a 64
|
||||
character hex token.
|
||||
|
||||
This command can also accept a password through STDIN instead of an
|
||||
argument by passing a hyphen as an argument. Example:
|
||||
argument by passing a hyphen as an argument. This will use the first
|
||||
line of STDIN as the password not including the trailing newline.
|
||||
|
||||
echo "secretpassword" | rclone obscure -
|
||||
|
||||
@@ -40,13 +41,18 @@ obfuscating the hyphen itself.
|
||||
If you want to encrypt the config file then please use config file
|
||||
encryption - see [rclone config](/commands/rclone_config/) for more
|
||||
info.`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
RunE: func(command *cobra.Command, args []string) error {
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
var password string
|
||||
fi, _ := os.Stdin.Stat()
|
||||
if args[0] == "-" && (fi.Mode()&os.ModeCharDevice) == 0 {
|
||||
bytes, _ := ioutil.ReadAll(os.Stdin)
|
||||
password = string(bytes)
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
if scanner.Scan() {
|
||||
password = scanner.Text()
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
password = args[0]
|
||||
}
|
||||
@@ -55,5 +61,6 @@ info.`,
|
||||
fmt.Println(obscured)
|
||||
return nil
|
||||
})
|
||||
return nil
|
||||
},
|
||||
}
|
||||
+12
-1
@@ -184,7 +184,7 @@ put them back in again.` >}}
|
||||
* Andres Alvarez <1671935+kir4h@users.noreply.github.com>
|
||||
* reddi1 <xreddi@gmail.com>
|
||||
* Matt Tucker <matthewtckr@gmail.com>
|
||||
* Sebastian Bünger <buengese@gmail.com>
|
||||
* Sebastian Bünger <buengese@gmail.com> <buengese@protonmail.com>
|
||||
* Martin Polden <mpolden@mpolden.no>
|
||||
* Alex Chen <Cnly@users.noreply.github.com>
|
||||
* Denis <deniskovpen@gmail.com>
|
||||
@@ -445,3 +445,14 @@ put them back in again.` >}}
|
||||
* Yury Stankevich <urykhy@gmail.com>
|
||||
* kice <wslikerqs@gmail.com>
|
||||
* Denis Neuling <denisneuling@gmail.com>
|
||||
* Janne Johansson <icepic.dz@gmail.com>
|
||||
* Patrik Nordlén <patriki@gmail.com>
|
||||
* CokeMine <aptx4561@gmail.com>
|
||||
* Sơn Trần-Nguyễn <github@sntran.com>
|
||||
* lluuaapp <266615+lluuaapp@users.noreply.github.com>
|
||||
* Zach Kipp <kipp.zach@gmail.com>
|
||||
* Riccardo Iaconelli <riccardo@kde.org>
|
||||
* Sakuragawa Misty <gyc990326@gmail.com>
|
||||
* Nicolas Rueff <nicolas@rueff.fr>
|
||||
* Pau Rodriguez-Estivill <prodrigestivill@gmail.com>
|
||||
* Bob Pusateri <BobPusateri@users.noreply.github.com>
|
||||
@@ -160,6 +160,26 @@ Storage Account Name (leave blank to use SAS URL or Emulator)
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-service-principal-file
|
||||
|
||||
Path to file containing credentials for use with a service principal.
|
||||
|
||||
Leave blank normally. Needed only if you want to use a service principal instead of interactive login.
|
||||
|
||||
$ az sp create-for-rbac --name "<name>" \
|
||||
--role "Storage Blob Data Owner" \
|
||||
--scopes "/subscriptions/<subscription>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<storage-account>/blobServices/default/containers/<container>" \
|
||||
> azure-principal.json
|
||||
|
||||
See [Use Azure CLI to assign an Azure role for access to blob and queue data](https://docs.microsoft.com/en-us/azure/storage/common/storage-auth-aad-rbac-cli)
|
||||
for more details.
|
||||
|
||||
|
||||
- Config: service_principal_file
|
||||
- Env Var: RCLONE_AZUREBLOB_SERVICE_PRINCIPAL_FILE
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-key
|
||||
|
||||
Storage Account Key (leave blank to use SAS URL or Emulator)
|
||||
@@ -179,6 +199,24 @@ SAS URL for container level access only
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-use-msi
|
||||
|
||||
Use a managed service identity to authenticate (only works in Azure)
|
||||
|
||||
When true, use a [managed service identity](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/)
|
||||
to authenticate to Azure Storage instead of a SAS token or account key.
|
||||
|
||||
If the VM(SS) on which this program is running has a system-assigned identity, it will
|
||||
be used by default. If the resource has no system-assigned but exactly one user-assigned identity,
|
||||
the user-assigned identity will be used by default. If the resource has multiple user-assigned
|
||||
identities, the identity to use must be explicitly specified using exactly one of the msi_object_id,
|
||||
msi_client_id, or msi_mi_res_id parameters.
|
||||
|
||||
- Config: use_msi
|
||||
- Env Var: RCLONE_AZUREBLOB_USE_MSI
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --azureblob-use-emulator
|
||||
|
||||
Uses local storage emulator if provided as 'true' (leave blank if using real azure storage endpoint)
|
||||
@@ -192,6 +230,33 @@ Uses local storage emulator if provided as 'true' (leave blank if using real azu
|
||||
|
||||
Here are the advanced options specific to azureblob (Microsoft Azure Blob Storage).
|
||||
|
||||
#### --azureblob-msi-object-id
|
||||
|
||||
Object ID of the user-assigned MSI to use, if any. Leave blank if msi_client_id or msi_mi_res_id specified.
|
||||
|
||||
- Config: msi_object_id
|
||||
- Env Var: RCLONE_AZUREBLOB_MSI_OBJECT_ID
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-msi-client-id
|
||||
|
||||
Object ID of the user-assigned MSI to use, if any. Leave blank if msi_object_id or msi_mi_res_id specified.
|
||||
|
||||
- Config: msi_client_id
|
||||
- Env Var: RCLONE_AZUREBLOB_MSI_CLIENT_ID
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-msi-mi-res-id
|
||||
|
||||
Azure resource ID of the user-assigned MSI to use, if any. Leave blank if msi_client_id or msi_object_id specified.
|
||||
|
||||
- Config: msi_mi_res_id
|
||||
- Env Var: RCLONE_AZUREBLOB_MSI_MI_RES_ID
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-endpoint
|
||||
|
||||
Endpoint for the service
|
||||
@@ -202,6 +267,15 @@ Leave blank normally.
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-upload-cutoff
|
||||
|
||||
Cutoff for switching to chunked upload (<= 256MB). (Deprecated)
|
||||
|
||||
- Config: upload_cutoff
|
||||
- Env Var: RCLONE_AZUREBLOB_UPLOAD_CUTOFF
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-chunk-size
|
||||
|
||||
Upload chunk size (<= 100MB).
|
||||
@@ -251,6 +325,28 @@ tiering blob to "Hot" or "Cool".
|
||||
- Type: string
|
||||
- Default: ""
|
||||
|
||||
#### --azureblob-archive-tier-delete
|
||||
|
||||
Delete archive tier blobs before overwriting.
|
||||
|
||||
Archive tier blobs cannot be updated. So without this flag, if you
|
||||
attempt to update an archive tier blob, then rclone will produce the
|
||||
error:
|
||||
|
||||
can't update archive tier blob without --azureblob-archive-tier-delete
|
||||
|
||||
With this flag set then before rclone attempts to overwrite an archive
|
||||
tier blob, it will delete the existing blob before uploading its
|
||||
replacement. This has the potential for data loss if the upload fails
|
||||
(unlike updating a normal blob) and also may cost more since deleting
|
||||
archive tier blobs early may be chargable.
|
||||
|
||||
|
||||
- Config: archive_tier_delete
|
||||
- Env Var: RCLONE_AZUREBLOB_ARCHIVE_TIER_DELETE
|
||||
- Type: bool
|
||||
- Default: false
|
||||
|
||||
#### --azureblob-disable-checksum
|
||||
|
||||
Don't store MD5 checksum with object metadata.
|
||||
|
||||
+3
-1
@@ -461,7 +461,9 @@ Custom endpoint for downloads.
|
||||
|
||||
This is usually set to a Cloudflare CDN URL as Backblaze offers
|
||||
free egress for data downloaded through the Cloudflare network.
|
||||
This is probably only useful for a public bucket.
|
||||
Rclone works with private buckets by sending an "Authorization" header.
|
||||
If the custom endpoint rewrites the requests for authentication,
|
||||
e.g., in Cloudflare Workers, this header needs to be handled properly.
|
||||
Leave blank if you want to use the endpoint provided by Backblaze.
|
||||
|
||||
- Config: download_url
|
||||
|
||||
@@ -5,6 +5,257 @@ description: "Rclone Changelog"
|
||||
|
||||
# Changelog
|
||||
|
||||
## v1.54.0 - 2021-02-02
|
||||
|
||||
[See commits](https://github.com/rclone/rclone/compare/v1.53.0...v1.54.0)
|
||||
|
||||
* New backends
|
||||
* Compression remote (experimental) (buengese)
|
||||
* Enterprise File Fabric (Nick Craig-Wood)
|
||||
* This work was sponsored by [Storage Made Easy](https://storagemadeeasy.com/)
|
||||
* HDFS (Hadoop Distributed File System) (Yury Stankevich)
|
||||
* Zoho workdrive (buengese)
|
||||
* New Features
|
||||
* Deglobalise the config (Nick Craig-Wood)
|
||||
* Global config now read from the context
|
||||
* This will enable passing of global config via the rc
|
||||
* This work was sponsored by [Digitalis](digitalis.io)
|
||||
* Add `--bwlimit` for upload and download (Nick Craig-Wood)
|
||||
* Obey bwlimit in http Transport for better limiting
|
||||
* Enhance systemd integration (Hekmon)
|
||||
* log level identification, manual activation with flag, automatic systemd launch detection
|
||||
* Don't compile systemd log integration for non unix systems (Benjamin Gustin)
|
||||
* Add a `--download` flag to md5sum/sha1sum/hashsum to force rclone to download and hash files locally (lostheli)
|
||||
* Add `--progress-terminal-title` to print ETA to terminal title (LaSombra)
|
||||
* Make backend env vars show in help as the defaults for backend flags (Nick Craig-Wood)
|
||||
* build
|
||||
* Raise minimum go version to go1.12 (Nick Craig-Wood)
|
||||
* dedupe
|
||||
* Add `--by-hash` to dedupe on content hash not file name (Nick Craig-Wood)
|
||||
* Add `--dedupe-mode list` to just list dupes, changing nothing (Nick Craig-Wood)
|
||||
* Add warning if used on a remote which can't have duplicate names (Nick Craig-Wood)
|
||||
* fs
|
||||
* Add Shutdown optional method for backends (Nick Craig-Wood)
|
||||
* When using `--files-from` check files concurrently (zhucan)
|
||||
* Accumulate stats when using `--dry-run` (Ingo Weiss)
|
||||
* Always show stats when using `--dry-run` or `--interactive` (Nick Craig-Wood)
|
||||
* Add support for flag `--no-console` on windows to hide the console window (albertony)
|
||||
* genautocomplete: Add support to output to stdout (Ingo)
|
||||
* ncdu
|
||||
* Highlight read errors instead of aborting (Claudio Bantaloukas)
|
||||
* Add sort by average size in directory (Adam Plánský)
|
||||
* Add toggle option for average s3ize in directory - key 'a' (Adam Plánský)
|
||||
* Add empty folder flag into ncdu browser (Adam Plánský)
|
||||
* Add `!` (errror) and `.` (unreadable) file flags to go with `e` (empty) (Nick Craig-Wood)
|
||||
* obscure: Make `rclone osbcure -` ignore newline at end of line (Nick Craig-Wood)
|
||||
* operations
|
||||
* Add logs when need to upload files to set mod times (Nick Craig-Wood)
|
||||
* Move and copy log name of the destination object in verbose (Adam Plánský)
|
||||
* Add size if known to skipped items and JSON log (Nick Craig-Wood)
|
||||
* rc
|
||||
* Prefer actual listener address if using ":port" or "addr:0" only (Nick Craig-Wood)
|
||||
* Add listener for finished jobs (Aleksandar Jankovic)
|
||||
* serve ftp: Add options to enable TLS (Deepak Sah)
|
||||
* serve http/webdav: Redirect requests to the base url without the / (Nick Craig-Wood)
|
||||
* serve restic: Implement object cache (Nick Craig-Wood)
|
||||
* stats: Add counter for deleted directories (Nick Craig-Wood)
|
||||
* sync: Only print "There was nothing to transfer" if no errors (Nick Craig-Wood)
|
||||
* webui
|
||||
* Prompt user for updating webui if an update is available (Chaitanya Bankanhal)
|
||||
* Fix plugins initialization (negative0)
|
||||
* Bug Fixes
|
||||
* fs
|
||||
* Fix nil pointer on copy & move operations directly to remote (Anagh Kumar Baranwal)
|
||||
* Fix parsing of .. when joining remotes (Nick Craig-Wood)
|
||||
* log: Fix enabling systemd logging when using `--log-file` (Nick Craig-Wood)
|
||||
* check
|
||||
* Make the error count match up in the log message (Nick Craig-Wood)
|
||||
* move: Fix data loss when source and destination are the same object (Nick Craig-Wood)
|
||||
* operations
|
||||
* Fix `--cutof-mode` hard not cutting off immediately (Nick Craig-Wood)
|
||||
* Fix `--immutable` error message (Nick Craig-Wood)
|
||||
* sync
|
||||
* Fix `--cutoff-mode` soft & cautious so it doesn't end the transfer early (Nick Craig-Wood)
|
||||
* Fix `--immutable` errors retrying many times (Nick Craig-Wood)
|
||||
* Docs
|
||||
* Many fixes and a rewrite of the filtering docs (edwardxml)
|
||||
* Many spelling and grammar fixes (Josh Soref)
|
||||
* Doc fixes for commands delete, purge, rmdir, rmdirs and mount (albertony)
|
||||
* And thanks to these people for many doc fixes too numerous to list
|
||||
* Ameer Dawood, Antoine GIRARD, Bob Bagwill, Christopher Stewart
|
||||
* CokeMine, David, Dov Murik, Durval Menezes, Evan Harris, gtorelly
|
||||
* Ilyess Bachiri, Janne Johansson, Kerry Su, Marcin Zelent,
|
||||
* Martin Michlmayr, Milly, Sơn Trần-Nguyễn
|
||||
* Mount
|
||||
* Update systemd status with cache stats (Hekmon)
|
||||
* Disable bazil/fuse based mount on macOS (Nick Craig-Wood)
|
||||
* Make `rclone mount` actually run `rclone cmount` under macOS (Nick Craig-Wood)
|
||||
* Implement mknod to make NFS file creation work (Nick Craig-Wood)
|
||||
* Make sure we don't call umount more than once (Nick Craig-Wood)
|
||||
* More user friendly mounting as network drive on windows (albertony)
|
||||
* Detect if uid or gid are set in same option string: -o uid=123,gid=456 (albertony)
|
||||
* Don't attempt to unmount if fs has been destroyed already (Nick Craig-Wood)
|
||||
* VFS
|
||||
* Fix virtual entries causing deleted files to still appear (Nick Craig-Wood)
|
||||
* Fix "file already exists" error for stale cache files (Nick Craig-Wood)
|
||||
* Fix file leaks with `--vfs-cache-mode` full and `--buffer-size 0` (Nick Craig-Wood)
|
||||
* Fix invalid cache path on windows when using :backend: as remote (albertony)
|
||||
* Local
|
||||
* Continue listing files/folders when a circular symlink is detected (Manish Gupta)
|
||||
* New flag `--local-zero-size-links` to fix sync on some virtual filesystems (Riccardo Iaconelli)
|
||||
* Azure Blob
|
||||
* Add support for service principals (James Lim)
|
||||
* Add support for managed identities (Brad Ackerman)
|
||||
* Add examples for access tier (Bob Pusateri)
|
||||
* Utilize the streaming capabilities from the SDK for multipart uploads (Denis Neuling)
|
||||
* Fix setting of mime types (Nick Craig-Wood)
|
||||
* Fix crash when listing outside a SAS URL's root (Nick Craig-Wood)
|
||||
* Delete archive tier blobs before update if `--azureblob-archive-tier-delete` (Nick Craig-Wood)
|
||||
* Fix crash on startup (Nick Craig-Wood)
|
||||
* Fix memory usage by upgrading the SDK to v0.13.0 and implementing a TransferManager (Nick Craig-Wood)
|
||||
* Require go1.14+ to compile due to SDK changes (Nick Craig-Wood)
|
||||
* B2
|
||||
* Make NewObject use less expensive API calls (Nick Craig-Wood)
|
||||
* This will improve `--files-from` and `restic serve` in particular
|
||||
* Fixed crash on an empty file name (lluuaapp)
|
||||
* Box
|
||||
* Fix NewObject for files that differ in case (Nick Craig-Wood)
|
||||
* Fix finding directories in a case insentive way (Nick Craig-Wood)
|
||||
* Chunker
|
||||
* Skip long local hashing, hash in-transit (fixes) (Ivan Andreev)
|
||||
* Set Features ReadMimeType to false as Object.MimeType not supported (Nick Craig-Wood)
|
||||
* Fix case-insensitive NewObject, test metadata detection (Ivan Andreev)
|
||||
* Drive
|
||||
* Implement `rclone backend copyid` command for copying files by ID (Nick Craig-Wood)
|
||||
* Added flag `--drive-stop-on-download-limit` to stop transfers when the download limit is exceeded (Anagh Kumar Baranwal)
|
||||
* Implement CleanUp workaround for team drives (buengese)
|
||||
* Allow shortcut resolution and creation to be retried (Nick Craig-Wood)
|
||||
* Log that emptying the trash can take some time (Nick Craig-Wood)
|
||||
* Add xdg office icons to xdg desktop files (Pau Rodriguez-Estivill)
|
||||
* Dropbox
|
||||
* Add support for viewing shared files and folders (buengese)
|
||||
* Enable short lived access tokens (Nick Craig-Wood)
|
||||
* Implement IDer on Objects so `rclone lsf` etc can read the IDs (buengese)
|
||||
* Set Features ReadMimeType to false as Object.MimeType not supported (Nick Craig-Wood)
|
||||
* Make malformed_path errors from too long files not retriable (Nick Craig-Wood)
|
||||
* Test file name length before upload to fix upload loop (Nick Craig-Wood)
|
||||
* Fichier
|
||||
* Set Features ReadMimeType to true as Object.MimeType is supported (Nick Craig-Wood)
|
||||
* FTP
|
||||
* Add `--ftp-disable-msld` option to ignore MLSD for really old servers (Nick Craig-Wood)
|
||||
* Make `--tpslimit apply` (Nick Craig-Wood)
|
||||
* Google Cloud Storage
|
||||
* Storage class object header support (Laurens Janssen)
|
||||
* Fix anonymous client to use rclone's HTTP client (Nick Craig-Wood)
|
||||
* Fix `Entry doesn't belong in directory "" (same as directory) - ignoring` (Nick Craig-Wood)
|
||||
* Googlephotos
|
||||
* New flag `--gphotos-include-archived` to show archived photos as well (Nicolas Rueff)
|
||||
* Jottacloud
|
||||
* Don't erroneously report support for writing mime types (buengese)
|
||||
* Add support for Telia Cloud (Patrik Nordlén)
|
||||
* Mailru
|
||||
* Accept special folders eg camera-upload (Ivan Andreev)
|
||||
* Avoid prehashing of large local files (Ivan Andreev)
|
||||
* Fix uploads after recent changes on server (Ivan Andreev)
|
||||
* Fix range requests after June 2020 changes on server (Ivan Andreev)
|
||||
* Fix invalid timestamp on corrupted files (fixes) (Ivan Andreev)
|
||||
* Remove deprecated protocol quirks (Ivan Andreev)
|
||||
* Memory
|
||||
* Fix setting of mime types (Nick Craig-Wood)
|
||||
* Onedrive
|
||||
* Add support for China region operated by 21vianet and other regional suppliers (NyaMisty)
|
||||
* Warn on gateway timeout errors (Nick Craig-Wood)
|
||||
* Fall back to normal copy if server-side copy unavailable (Alex Chen)
|
||||
* Fix server-side copy completely disabled on OneDrive for Business (Cnly)
|
||||
* (business only) workaround to replace existing file on server-side copy (Alex Chen)
|
||||
* Enhance link creation with expiry, scope, type and password (Nick Craig-Wood)
|
||||
* Remove % and # from the set of encoded characters (Alex Chen)
|
||||
* Support addressing site by server-relative URL (kice)
|
||||
* Opendrive
|
||||
* Fix finding directories in a case insensitive way (Nick Craig-Wood)
|
||||
* Pcloud
|
||||
* Fix setting of mime types (Nick Craig-Wood)
|
||||
* Premiumizeme
|
||||
* Fix finding directories in a case insensitive way (Nick Craig-Wood)
|
||||
* Qingstor
|
||||
* Fix error propagation in CleanUp (Nick Craig-Wood)
|
||||
* Fix rclone cleanup (Nick Craig-Wood)
|
||||
* S3
|
||||
* Added `--s3-disable-http2` to disable http/2 (Anagh Kumar Baranwal)
|
||||
* Complete SSE-C implementation (Nick Craig-Wood)
|
||||
* Fix hashes on small files with AWS:KMS and SSE-C (Nick Craig-Wood)
|
||||
* Add MD5 metadata to objects uploaded with SSE-AWS/SSE-C (Nick Craig-Wood)
|
||||
* Add `--s3-no-head parameter` to minimise transactions on upload (Nick Craig-Wood)
|
||||
* Update docs with a Reducing Costs section (Nick Craig-Wood)
|
||||
* Added error handling for error code 429 indicating too many requests (Anagh Kumar Baranwal)
|
||||
* Add requester pays option (kelv)
|
||||
* Fix copy multipart with v2 auth failing with 'SignatureDoesNotMatch' (Louis Koo)
|
||||
* SFTP
|
||||
* Allow cert based auth via optional pubkey (Stephen Harris)
|
||||
* Allow user to optionally check server hosts key to add security (Stephen Harris)
|
||||
* Defer asking for user passwords until the SSH connection succeeds (Stephen Harris)
|
||||
* Remember entered password in AskPass mode (Stephen Harris)
|
||||
* Implement Shutdown method (Nick Craig-Wood)
|
||||
* Implement keyboard interactive authentication (Nick Craig-Wood)
|
||||
* Make `--tpslimit` apply (Nick Craig-Wood)
|
||||
* Implement `--sftp-use-fstat` for unusual SFTP servers (Nick Craig-Wood)
|
||||
* Sugarsync
|
||||
* Fix NewObject for files that differ in case (Nick Craig-Wood)
|
||||
* Fix finding directories in a case insentive way (Nick Craig-Wood)
|
||||
* Swift
|
||||
* Fix deletion of parts of Static Large Object (SLO) (Nguyễn Hữu Luân)
|
||||
* Ensure partially uploaded large files are uploaded unless `--swift-leave-parts-on-error` (Nguyễn Hữu Luân)
|
||||
* Tardigrade
|
||||
* Upgrade to uplink v1.4.1 (Caleb Case)
|
||||
* WebDAV
|
||||
* Updated docs to show streaming to nextcloud is working (Durval Menezes)
|
||||
* Yandex
|
||||
* Set Features WriteMimeType to false as Yandex ignores mime types (Nick Craig-Wood)
|
||||
|
||||
## v1.53.4 - 2021-01-20
|
||||
|
||||
[See commits](https://github.com/rclone/rclone/compare/v1.53.3...v1.53.4)
|
||||
|
||||
* Bug Fixes
|
||||
* accounting: Fix data race in Transferred() (Maciej Zimnoch)
|
||||
* build
|
||||
* Stop tagged releases making a current beta (Nick Craig-Wood)
|
||||
* Upgrade docker buildx action (Matteo Pietro Dazzi)
|
||||
* Add -buildmode to cross-compile.go (Nick Craig-Wood)
|
||||
* Fix docker build by upgrading ilteoood/docker_buildx (Nick Craig-Wood)
|
||||
* Revert GitHub actions brew fix since this is now fixed (Nick Craig-Wood)
|
||||
* Fix brew install --cask syntax for macOS build (Nick Craig-Wood)
|
||||
* Update nfpm syntax to fix build of .deb/.rpm packages (Nick Craig-Wood)
|
||||
* Fix for Windows build errors (Ivan Andreev)
|
||||
* fs: Parseduration: fixed tests to use UTC time (Ankur Gupta)
|
||||
* fshttp: Prevent overlap of HTTP headers in logs (Nathan Collins)
|
||||
* rc
|
||||
* Fix core/command giving 500 internal error (Nick Craig-Wood)
|
||||
* Add Copy method to rc.Params (Nick Craig-Wood)
|
||||
* Fix 500 error when marshalling errors from core/command (Nick Craig-Wood)
|
||||
* plugins: Create plugins files only if webui is enabled. (negative0)
|
||||
* serve http: Fix serving files of unknown length (Nick Craig-Wood)
|
||||
* serve sftp: Fix authentication on one connection blocking others (Nick Craig-Wood)
|
||||
* Mount
|
||||
* Add optional `brew` tag to throw an error when using mount in the binaries installed via Homebrew (Anagh Kumar Baranwal)
|
||||
* Add "." and ".." to directories to match cmount and expectations (Nick Craig-Wood)
|
||||
* VFS
|
||||
* Make cache dir absolute before using it to fix path too long errors (Nick Craig-Wood)
|
||||
* Chunker
|
||||
* Improve detection of incompatible metadata (Ivan Andreev)
|
||||
* Google Cloud Storage
|
||||
* Fix server side copy of large objects (Nick Craig-Wood)
|
||||
* Jottacloud
|
||||
* Fix token renewer to fix long uploads (Nick Craig-Wood)
|
||||
* Fix token refresh failed: is not a regular file error (Nick Craig-Wood)
|
||||
* Pcloud
|
||||
* Only use SHA1 hashes in EU region (Nick Craig-Wood)
|
||||
* Sharefile
|
||||
* Undo Fix backend due to API swapping integers for strings (Nick Craig-Wood)
|
||||
* WebDAV
|
||||
* Fix Open Range requests to fix 4shared mount (Nick Craig-Wood)
|
||||
* Add "Depth: 0" to GET requests to fix bitrix (Nick Craig-Wood)
|
||||
|
||||
## v1.53.3 - 2020-11-19
|
||||
|
||||
[See commits](https://github.com/rclone/rclone/compare/v1.53.2...v1.53.3)
|
||||
|
||||
@@ -39,15 +39,15 @@ See the [global flags page](/flags/) for global options not listed here.
|
||||
* [rclone backend](/commands/rclone_backend/) - Run a backend specific command.
|
||||
* [rclone cat](/commands/rclone_cat/) - Concatenates any files and sends them to stdout.
|
||||
* [rclone check](/commands/rclone_check/) - Checks the files in the source and destination match.
|
||||
* [rclone cleanup](/commands/rclone_cleanup/) - Clean up the remote if possible
|
||||
* [rclone cleanup](/commands/rclone_cleanup/) - Clean up the remote if possible.
|
||||
* [rclone config](/commands/rclone_config/) - Enter an interactive configuration session.
|
||||
* [rclone copy](/commands/rclone_copy/) - Copy files from source to dest, skipping already copied
|
||||
* [rclone copyto](/commands/rclone_copyto/) - Copy files from source to dest, skipping already copied
|
||||
* [rclone copy](/commands/rclone_copy/) - Copy files from source to dest, skipping already copied.
|
||||
* [rclone copyto](/commands/rclone_copyto/) - Copy files from source to dest, skipping already copied.
|
||||
* [rclone copyurl](/commands/rclone_copyurl/) - Copy url content to dest.
|
||||
* [rclone cryptcheck](/commands/rclone_cryptcheck/) - Cryptcheck checks the integrity of a crypted remote.
|
||||
* [rclone cryptdecode](/commands/rclone_cryptdecode/) - Cryptdecode returns unencrypted file names.
|
||||
* [rclone dedupe](/commands/rclone_dedupe/) - Interactively find duplicate filenames and delete/rename them.
|
||||
* [rclone delete](/commands/rclone_delete/) - Remove the contents of path.
|
||||
* [rclone delete](/commands/rclone_delete/) - Remove the files in path.
|
||||
* [rclone deletefile](/commands/rclone_deletefile/) - Remove a single file from remote.
|
||||
* [rclone genautocomplete](/commands/rclone_genautocomplete/) - Output completion script for a given shell.
|
||||
* [rclone gendocs](/commands/rclone_gendocs/) - Output markdown docs for rclone to the directory supplied.
|
||||
@@ -56,7 +56,7 @@ See the [global flags page](/flags/) for global options not listed here.
|
||||
* [rclone listremotes](/commands/rclone_listremotes/) - List all the remotes in the config file.
|
||||
* [rclone ls](/commands/rclone_ls/) - List the objects in the path with size and path.
|
||||
* [rclone lsd](/commands/rclone_lsd/) - List all directories/containers/buckets in the path.
|
||||
* [rclone lsf](/commands/rclone_lsf/) - List directories and objects in remote:path formatted for parsing
|
||||
* [rclone lsf](/commands/rclone_lsf/) - List directories and objects in remote:path formatted for parsing.
|
||||
* [rclone lsjson](/commands/rclone_lsjson/) - List directories and objects in the path in JSON format.
|
||||
* [rclone lsl](/commands/rclone_lsl/) - List the objects in path with modification time, size and path.
|
||||
* [rclone md5sum](/commands/rclone_md5sum/) - Produces an md5sum file for all the objects in the path.
|
||||
@@ -65,12 +65,12 @@ See the [global flags page](/flags/) for global options not listed here.
|
||||
* [rclone move](/commands/rclone_move/) - Move files from source to dest.
|
||||
* [rclone moveto](/commands/rclone_moveto/) - Move file or directory from source to dest.
|
||||
* [rclone ncdu](/commands/rclone_ncdu/) - Explore a remote with a text based user interface.
|
||||
* [rclone obscure](/commands/rclone_obscure/) - Obscure password for use in the rclone config file
|
||||
* [rclone obscure](/commands/rclone_obscure/) - Obscure password for use in the rclone config file.
|
||||
* [rclone purge](/commands/rclone_purge/) - Remove the path and all of its contents.
|
||||
* [rclone rc](/commands/rclone_rc/) - Run a command against a running rclone.
|
||||
* [rclone rcat](/commands/rclone_rcat/) - Copies standard input to file on remote.
|
||||
* [rclone rcd](/commands/rclone_rcd/) - Run rclone listening to remote control commands only.
|
||||
* [rclone rmdir](/commands/rclone_rmdir/) - Remove the path if empty.
|
||||
* [rclone rmdir](/commands/rclone_rmdir/) - Remove the empty directory at path.
|
||||
* [rclone rmdirs](/commands/rclone_rmdirs/) - Remove empty directories under the path.
|
||||
* [rclone serve](/commands/rclone_serve/) - Serve a remote over a protocol.
|
||||
* [rclone settier](/commands/rclone_settier/) - Changes storage class/tier of objects in remote.
|
||||
|
||||
@@ -12,10 +12,10 @@ Get quota information from the remote.
|
||||
## Synopsis
|
||||
|
||||
|
||||
Get quota information from the remote, like bytes used/free/quota and bytes
|
||||
used in the trash. Not supported by all remotes.
|
||||
`rclone about`prints quota information about a remote to standard
|
||||
output. The output is typically used, free, quota and trash contents.
|
||||
|
||||
This will print to stdout something like this:
|
||||
E.g. Typical output from`rclone about remote:`is:
|
||||
|
||||
Total: 17G
|
||||
Used: 7.444G
|
||||
@@ -27,16 +27,15 @@ Where the fields are:
|
||||
|
||||
* Total: total size available.
|
||||
* Used: total size used
|
||||
* Free: total amount this user could upload.
|
||||
* Trashed: total amount in the trash
|
||||
* Other: total amount in other storage (eg Gmail, Google Photos)
|
||||
* Free: total space available to this user.
|
||||
* Trashed: total space used by trash
|
||||
* Other: total amount in other storage (e.g. Gmail, Google Photos)
|
||||
* Objects: total number of objects in the storage
|
||||
|
||||
Note that not all the backends provide all the fields - they will be
|
||||
missing if they are not known for that backend. Where it is known
|
||||
that the value is unlimited the value will also be omitted.
|
||||
Not all backends print all fields. Information is not included if it is not
|
||||
provided by a backend. Where the value is unlimited it is omitted.
|
||||
|
||||
Use the --full flag to see the numbers written out in full, eg
|
||||
Applying a `--full` flag to the command prints the bytes in full, e.g.
|
||||
|
||||
Total: 18253611008
|
||||
Used: 7993453766
|
||||
@@ -44,7 +43,7 @@ Use the --full flag to see the numbers written out in full, eg
|
||||
Trashed: 104857602
|
||||
Other: 8849156022
|
||||
|
||||
Use the --json flag for a computer readable output, eg
|
||||
A `--json`flag generates conveniently computer readable output, e.g.
|
||||
|
||||
{
|
||||
"total": 18253611008,
|
||||
@@ -54,6 +53,10 @@ Use the --json flag for a computer readable output, eg
|
||||
"free": 1411001220
|
||||
}
|
||||
|
||||
Not all backends support the `rclone about` command.
|
||||
|
||||
See [List of backends that do not support about](https://rclone.org/overview/#optional-features)
|
||||
|
||||
|
||||
```
|
||||
rclone about remote: [flags]
|
||||
|
||||
@@ -27,7 +27,7 @@ for more info).
|
||||
|
||||
rclone backend features remote:
|
||||
|
||||
Pass options to the backend command with -o. This should be key=value or key, eg:
|
||||
Pass options to the backend command with -o. This should be key=value or key, e.g.:
|
||||
|
||||
rclone backend stats remote:path stats -o format=json -o long
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ Or like this to output any .txt files in dir or its subdirectories.
|
||||
|
||||
rclone --include "*.txt" cat remote:path/to/dir
|
||||
|
||||
Use the --head flag to print characters only at the start, --tail for
|
||||
the end and --offset and --count to print a section in the middle.
|
||||
Use the `--head` flag to print characters only at the start, `--tail` for
|
||||
the end and `--offset` and `--count` to print a section in the middle.
|
||||
Note that if offset is negative it will count from the end, so
|
||||
--offset -1 --count 1 is equivalent to --tail 1.
|
||||
`--offset -1 --count 1` is equivalent to `--tail 1`.
|
||||
|
||||
|
||||
```
|
||||
|
||||
@@ -16,10 +16,10 @@ Checks the files in the source and destination match. It compares
|
||||
sizes and hashes (MD5 or SHA1) and logs a report of files which don't
|
||||
match. It doesn't alter the source or destination.
|
||||
|
||||
If you supply the --size-only flag, it will only compare the sizes not
|
||||
If you supply the `--size-only` flag, it will only compare the sizes not
|
||||
the hashes as well. Use this for a quick check.
|
||||
|
||||
If you supply the --download flag, it will download the data from
|
||||
If you supply the `--download` flag, it will download the data from
|
||||
both remotes and check them against each other on the fly. This can
|
||||
be useful for remotes that don't support hashes or if you really want
|
||||
to check all the data.
|
||||
@@ -29,7 +29,7 @@ the source match the files in the destination, not the other way
|
||||
around. This means that extra files in the destination that are not in
|
||||
the source will not be detected.
|
||||
|
||||
The `--differ`, `--missing-on-dst`, `--missing-on-src`, `--src-only`
|
||||
The `--differ`, `--missing-on-dst`, `--missing-on-src`, `--match`
|
||||
and `--error` flags write paths, one per line, to the file name (or
|
||||
stdout if it is `-`) supplied. What they write is described in the
|
||||
help below. For example `--differ` will write all paths which are
|
||||
@@ -55,6 +55,7 @@ rclone check source:path dest:path [flags]
|
||||
```
|
||||
--combined string Make a combined report of changes to this file
|
||||
--differ string Report all non-matching files to this file
|
||||
--download Check by downloading rather than with hash.
|
||||
--error string Report all files with errors (hashing or reading) to this file
|
||||
-h, --help help for check
|
||||
--match string Report all matching files to this file
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "rclone cleanup"
|
||||
description: "Clean up the remote if possible"
|
||||
description: "Clean up the remote if possible."
|
||||
slug: rclone_cleanup
|
||||
url: /commands/rclone_cleanup/
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/cleanup/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone cleanup
|
||||
|
||||
Clean up the remote if possible
|
||||
Clean up the remote if possible.
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ whether the password is already obscured or not and put unobscured
|
||||
passwords into the config file. If you want to be 100% certain that
|
||||
the passwords get obscured then use the "--obscure" flag, or if you
|
||||
are 100% certain you are already passing obscured passwords then use
|
||||
"--no-obscure". You can also set osbscured passwords using the
|
||||
"--no-obscure". You can also set obscured passwords using the
|
||||
"rclone config password" command.
|
||||
|
||||
So for example if you wanted to configure a Google Drive remote but
|
||||
|
||||
@@ -9,10 +9,6 @@ url: /commands/rclone_config_delete/
|
||||
|
||||
Delete an existing remote `name`.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Delete an existing remote `name`.
|
||||
|
||||
```
|
||||
rclone config delete `name` [flags]
|
||||
```
|
||||
|
||||
@@ -9,10 +9,6 @@ url: /commands/rclone_config_dump/
|
||||
|
||||
Dump the config file as JSON.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Dump the config file as JSON.
|
||||
|
||||
```
|
||||
rclone config dump [flags]
|
||||
```
|
||||
|
||||
@@ -9,10 +9,6 @@ url: /commands/rclone_config_file/
|
||||
|
||||
Show path of configuration file in use.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Show path of configuration file in use.
|
||||
|
||||
```
|
||||
rclone config file [flags]
|
||||
```
|
||||
|
||||
@@ -9,10 +9,6 @@ url: /commands/rclone_config_providers/
|
||||
|
||||
List in JSON format all the providers and options.
|
||||
|
||||
## Synopsis
|
||||
|
||||
List in JSON format all the providers and options.
|
||||
|
||||
```
|
||||
rclone config providers [flags]
|
||||
```
|
||||
|
||||
@@ -9,10 +9,6 @@ url: /commands/rclone_config_show/
|
||||
|
||||
Print (decrypted) config file, or the config for a single remote.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Print (decrypted) config file, or the config for a single remote.
|
||||
|
||||
```
|
||||
rclone config show [<remote>] [flags]
|
||||
```
|
||||
|
||||
@@ -30,7 +30,7 @@ whether the password is already obscured or not and put unobscured
|
||||
passwords into the config file. If you want to be 100% certain that
|
||||
the passwords get obscured then use the "--obscure" flag, or if you
|
||||
are 100% certain you are already passing obscured passwords then use
|
||||
"--no-obscure". You can also set osbscured passwords using the
|
||||
"--no-obscure". You can also set obscured passwords using the
|
||||
"rclone config password" command.
|
||||
|
||||
If the remote uses OAuth the token will be updated, if you don't
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "rclone copy"
|
||||
description: "Copy files from source to dest, skipping already copied"
|
||||
description: "Copy files from source to dest, skipping already copied."
|
||||
slug: rclone_copy
|
||||
url: /commands/rclone_copy/
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/copy/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone copy
|
||||
|
||||
Copy files from source to dest, skipping already copied
|
||||
Copy files from source to dest, skipping already copied.
|
||||
|
||||
## Synopsis
|
||||
|
||||
@@ -44,7 +44,7 @@ Not to
|
||||
destpath/sourcepath/two.txt
|
||||
|
||||
If you are familiar with `rsync`, rclone always works as if you had
|
||||
written a trailing / - meaning "copy the contents of this directory".
|
||||
written a trailing `/` - meaning "copy the contents of this directory".
|
||||
This applies to all commands and whether you are talking about the
|
||||
source or destination.
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "rclone copyto"
|
||||
description: "Copy files from source to dest, skipping already copied"
|
||||
description: "Copy files from source to dest, skipping already copied."
|
||||
slug: rclone_copyto
|
||||
url: /commands/rclone_copyto/
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/copyto/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone copyto
|
||||
|
||||
Copy files from source to dest, skipping already copied
|
||||
Copy files from source to dest, skipping already copied.
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ the source match the files in the destination, not the other way
|
||||
around. This means that extra files in the destination that are not in
|
||||
the source will not be detected.
|
||||
|
||||
The `--differ`, `--missing-on-dst`, `--missing-on-src`, `--src-only`
|
||||
The `--differ`, `--missing-on-dst`, `--missing-on-src`, `--match`
|
||||
and `--error` flags write paths, one per line, to the file name (or
|
||||
stdout if it is `-`) supplied. What they write is described in the
|
||||
help below. For example `--differ` will write all paths which are
|
||||
|
||||
@@ -23,6 +23,9 @@ use it like this
|
||||
|
||||
rclone cryptdecode --reverse encryptedremote: filename1 filename2
|
||||
|
||||
Another way to accomplish this is by using the `rclone backend encode` (or `decode`)command.
|
||||
See the documentation on the `crypt` overlay for more info.
|
||||
|
||||
|
||||
```
|
||||
rclone cryptdecode encryptedremote: encryptedfilename [flags]
|
||||
|
||||
@@ -15,28 +15,37 @@ Interactively find duplicate filenames and delete/rename them.
|
||||
|
||||
By default `dedupe` interactively finds files with duplicate
|
||||
names and offers to delete all but one or rename them to be
|
||||
different.
|
||||
different. This is known as deduping by name.
|
||||
|
||||
This is only useful with backends like Google Drive which can have
|
||||
duplicate file names. It can be run on wrapping backends (eg crypt) if
|
||||
they wrap a backend which supports duplicate file names.
|
||||
Deduping by name is only useful with backends like Google Drive which
|
||||
can have duplicate file names. It can be run on wrapping backends
|
||||
(e.g. crypt) if they wrap a backend which supports duplicate file
|
||||
names.
|
||||
|
||||
In the first pass it will merge directories with the same name. It
|
||||
will do this iteratively until all the identically named directories
|
||||
have been merged.
|
||||
However if --by-hash is passed in then dedupe will find files with
|
||||
duplicate hashes instead which will work on any backend which supports
|
||||
at least one hash. This can be used to find files with duplicate
|
||||
content. This is known as deduping by hash.
|
||||
|
||||
In the second pass, for every group of duplicate file names, it will
|
||||
delete all but one identical files it finds without confirmation.
|
||||
This means that for most duplicated files the `dedupe`
|
||||
command will not be interactive.
|
||||
If deduping by name, first rclone will merge directories with the same
|
||||
name. It will do this iteratively until all the identically named
|
||||
directories have been merged.
|
||||
|
||||
Next, if deduping by name, for every group of duplicate file names /
|
||||
hashes, it will delete all but one identical files it finds without
|
||||
confirmation. This means that for most duplicated files the `dedupe` command will not be interactive.
|
||||
|
||||
`dedupe` considers files to be identical if they have the
|
||||
same hash. If the backend does not support hashes (eg crypt wrapping
|
||||
same file path and the same hash. If the backend does not support hashes (e.g. crypt wrapping
|
||||
Google Drive) then they will never be found to be identical. If you
|
||||
use the `--size-only` flag then files will be considered
|
||||
identical if they have the same size (any hash will be ignored). This
|
||||
can be useful on crypt backends which do not support hashes.
|
||||
|
||||
Next rclone will resolve the remaining duplicates. Exactly which
|
||||
action is taken depends on the dedupe mode. By default rclone will
|
||||
interactively query the user for each one.
|
||||
|
||||
**Important**: Since this can cause data loss, test first with the
|
||||
`--dry-run` or the `--interactive`/`-i` flag.
|
||||
|
||||
@@ -68,7 +77,7 @@ Now the `dedupe` session
|
||||
s/k/r> k
|
||||
Enter the number of the file to keep> 1
|
||||
one.txt: Deleted 1 extra copies
|
||||
two.txt: Found 3 files with duplicates names
|
||||
two.txt: Found 3 files with duplicate names
|
||||
two.txt: 3 duplicates remain
|
||||
1: 564374 bytes, 2016-03-05 16:22:52.118000000, MD5 7594e7dc9fc28f727c42ee3e0749de81
|
||||
2: 6048320 bytes, 2016-03-05 16:22:46.185000000, MD5 1eedaa9fe86fd4b8632e2ac549403b36
|
||||
@@ -99,6 +108,7 @@ Dedupe can be run non interactively using the `--dedupe-mode` flag or by using a
|
||||
* `--dedupe-mode largest` - removes identical files then keeps the largest one.
|
||||
* `--dedupe-mode smallest` - removes identical files then keeps the smallest one.
|
||||
* `--dedupe-mode rename` - removes identical files then renames the rest to be different.
|
||||
* `--dedupe-mode list` - lists duplicate dirs and files only and changes nothing.
|
||||
|
||||
For example to rename all the identically named photos in your Google Photos directory, do
|
||||
|
||||
@@ -116,6 +126,7 @@ rclone dedupe [mode] remote:path [flags]
|
||||
## Options
|
||||
|
||||
```
|
||||
--by-hash Find indentical hashes rather than names
|
||||
--dedupe-mode string Dedupe mode interactive|skip|first|newest|oldest|largest|smallest|rename. (default "interactive")
|
||||
-h, --help help for dedupe
|
||||
```
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "rclone delete"
|
||||
description: "Remove the contents of path."
|
||||
description: "Remove the files in path."
|
||||
slug: rclone_delete
|
||||
url: /commands/rclone_delete/
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/delete/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone delete
|
||||
|
||||
Remove the contents of path.
|
||||
Remove the files in path.
|
||||
|
||||
## Synopsis
|
||||
|
||||
@@ -15,20 +15,21 @@ Remove the contents of path.
|
||||
Remove the files in path. Unlike `purge` it obeys include/exclude
|
||||
filters so can be used to selectively delete files.
|
||||
|
||||
`rclone delete` only deletes objects but leaves the directory structure
|
||||
`rclone delete` only deletes files but leaves the directory structure
|
||||
alone. If you want to delete a directory and all of its contents use
|
||||
`rclone purge`
|
||||
the `purge` command.
|
||||
|
||||
If you supply the --rmdirs flag, it will remove all empty directories along with it.
|
||||
If you supply the `--rmdirs` flag, it will remove all empty directories along with it.
|
||||
You can also use the separate command `rmdir` or `rmdirs` to
|
||||
delete empty directories only.
|
||||
|
||||
Eg delete all files bigger than 100MBytes
|
||||
|
||||
Check what would be deleted first (use either)
|
||||
For example, to delete all files bigger than 100MBytes, you may first want to check what
|
||||
would be deleted (use either):
|
||||
|
||||
rclone --min-size 100M lsl remote:path
|
||||
rclone --dry-run --min-size 100M delete remote:path
|
||||
|
||||
Then delete
|
||||
Then proceed with the actual delete:
|
||||
|
||||
rclone --min-size 100M delete remote:path
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ Output bash completion script for rclone.
|
||||
Generates a bash shell autocompletion script for rclone.
|
||||
|
||||
This writes to /etc/bash_completion.d/rclone by default so will
|
||||
probably need to be run with sudo or as root, eg
|
||||
probably need to be run with sudo or as root, e.g.
|
||||
|
||||
sudo rclone genautocomplete bash
|
||||
|
||||
@@ -27,7 +27,8 @@ them directly
|
||||
If you supply a command line argument the script will be written
|
||||
there.
|
||||
|
||||
If output_file is `-`, then the output will be written to stdout.
|
||||
If output_file is "-", then the output will be written to stdout.
|
||||
|
||||
|
||||
```
|
||||
rclone genautocomplete bash [output_file] [flags]
|
||||
|
||||
@@ -15,7 +15,7 @@ Output fish completion script for rclone.
|
||||
Generates a fish autocompletion script for rclone.
|
||||
|
||||
This writes to /etc/fish/completions/rclone.fish by default so will
|
||||
probably need to be run with sudo or as root, eg
|
||||
probably need to be run with sudo or as root, e.g.
|
||||
|
||||
sudo rclone genautocomplete fish
|
||||
|
||||
@@ -27,7 +27,8 @@ them directly
|
||||
If you supply a command line argument the script will be written
|
||||
there.
|
||||
|
||||
If output_file is `-`, then the output will be written to stdout.
|
||||
If output_file is "-", then the output will be written to stdout.
|
||||
|
||||
|
||||
```
|
||||
rclone genautocomplete fish [output_file] [flags]
|
||||
|
||||
@@ -15,7 +15,7 @@ Output zsh completion script for rclone.
|
||||
Generates a zsh autocompletion script for rclone.
|
||||
|
||||
This writes to /usr/share/zsh/vendor-completions/_rclone by default so will
|
||||
probably need to be run with sudo or as root, eg
|
||||
probably need to be run with sudo or as root, e.g.
|
||||
|
||||
sudo rclone genautocomplete zsh
|
||||
|
||||
@@ -27,7 +27,8 @@ them directly
|
||||
If you supply a command line argument the script will be written
|
||||
there.
|
||||
|
||||
If output_file is `-`, then the output will be written to stdout.
|
||||
If output_file is "-", then the output will be written to stdout.
|
||||
|
||||
|
||||
```
|
||||
rclone genautocomplete zsh [output_file] [flags]
|
||||
|
||||
@@ -38,12 +38,12 @@ There are several related list commands
|
||||
`lsf` is designed to be human and machine readable.
|
||||
`lsjson` is designed to be machine readable.
|
||||
|
||||
Note that `ls` and `lsl` recurse by default - use "--max-depth 1" to stop the recursion.
|
||||
Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the recursion.
|
||||
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use "-R" to make them recurse.
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use `-R` to make them recurse.
|
||||
|
||||
Listing a non existent directory will produce an error except for
|
||||
remotes which can't have empty directories (eg s3, swift, gcs, etc -
|
||||
remotes which can't have empty directories (e.g. s3, swift, or gcs -
|
||||
the bucket based remotes).
|
||||
|
||||
|
||||
|
||||
@@ -48,12 +48,12 @@ There are several related list commands
|
||||
`lsf` is designed to be human and machine readable.
|
||||
`lsjson` is designed to be machine readable.
|
||||
|
||||
Note that `ls` and `lsl` recurse by default - use "--max-depth 1" to stop the recursion.
|
||||
Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the recursion.
|
||||
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use "-R" to make them recurse.
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use `-R` to make them recurse.
|
||||
|
||||
Listing a non existent directory will produce an error except for
|
||||
remotes which can't have empty directories (eg s3, swift, gcs, etc -
|
||||
remotes which can't have empty directories (e.g. s3, swift, or gcs -
|
||||
the bucket based remotes).
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "rclone lsf"
|
||||
description: "List directories and objects in remote:path formatted for parsing"
|
||||
description: "List directories and objects in remote:path formatted for parsing."
|
||||
slug: rclone_lsf
|
||||
url: /commands/rclone_lsf/
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/lsf/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone lsf
|
||||
|
||||
List directories and objects in remote:path formatted for parsing
|
||||
List directories and objects in remote:path formatted for parsing.
|
||||
|
||||
## Synopsis
|
||||
|
||||
@@ -38,7 +38,7 @@ output:
|
||||
o - Original ID of underlying object
|
||||
m - MimeType of object if known
|
||||
e - encrypted name
|
||||
T - tier of storage if known, eg "Hot" or "Cool"
|
||||
T - tier of storage if known, e.g. "Hot" or "Cool"
|
||||
|
||||
So if you wanted the path, size and modification time, you would use
|
||||
--format "pst", or maybe --format "tsp" to put the path last.
|
||||
@@ -121,12 +121,12 @@ There are several related list commands
|
||||
`lsf` is designed to be human and machine readable.
|
||||
`lsjson` is designed to be machine readable.
|
||||
|
||||
Note that `ls` and `lsl` recurse by default - use "--max-depth 1" to stop the recursion.
|
||||
Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the recursion.
|
||||
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use "-R" to make them recurse.
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use `-R` to make them recurse.
|
||||
|
||||
Listing a non existent directory will produce an error except for
|
||||
remotes which can't have empty directories (eg s3, swift, gcs, etc -
|
||||
remotes which can't have empty directories (e.g. s3, swift, or gcs -
|
||||
the bucket based remotes).
|
||||
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ may be repeated). If --hash-type is set then it implies --hash.
|
||||
|
||||
If --no-modtime is specified then ModTime will be blank. This can
|
||||
speed things up on remotes where reading the ModTime takes an extra
|
||||
request (eg s3, swift).
|
||||
request (e.g. s3, swift).
|
||||
|
||||
If --no-mimetype is specified then MimeType will be blank. This can
|
||||
speed things up on remotes where reading the MimeType takes an extra
|
||||
request (eg s3, swift).
|
||||
request (e.g. s3, swift).
|
||||
|
||||
If --encrypted is not specified the Encrypted won't be emitted.
|
||||
|
||||
@@ -67,9 +67,9 @@ If the directory is a bucket in a bucket based backend, then
|
||||
The time is in RFC3339 format with up to nanosecond precision. The
|
||||
number of decimal digits in the seconds will depend on the precision
|
||||
that the remote can hold the times, so if times are accurate to the
|
||||
nearest millisecond (eg Google Drive) then 3 digits will always be
|
||||
nearest millisecond (e.g. Google Drive) then 3 digits will always be
|
||||
shown ("2017-05-31T16:15:57.034+01:00") whereas if the times are
|
||||
accurate to the nearest second (Dropbox, Box, WebDav etc) no digits
|
||||
accurate to the nearest second (Dropbox, Box, WebDav, etc.) no digits
|
||||
will be shown ("2017-05-31T16:15:57+01:00").
|
||||
|
||||
The whole output can be processed as a JSON blob, or alternatively it
|
||||
@@ -89,12 +89,12 @@ There are several related list commands
|
||||
`lsf` is designed to be human and machine readable.
|
||||
`lsjson` is designed to be machine readable.
|
||||
|
||||
Note that `ls` and `lsl` recurse by default - use "--max-depth 1" to stop the recursion.
|
||||
Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the recursion.
|
||||
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use "-R" to make them recurse.
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use `-R` to make them recurse.
|
||||
|
||||
Listing a non existent directory will produce an error except for
|
||||
remotes which can't have empty directories (eg s3, swift, gcs, etc -
|
||||
remotes which can't have empty directories (e.g. s3, swift, or gcs -
|
||||
the bucket based remotes).
|
||||
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@ There are several related list commands
|
||||
`lsf` is designed to be human and machine readable.
|
||||
`lsjson` is designed to be machine readable.
|
||||
|
||||
Note that `ls` and `lsl` recurse by default - use "--max-depth 1" to stop the recursion.
|
||||
Note that `ls` and `lsl` recurse by default - use `--max-depth 1` to stop the recursion.
|
||||
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use "-R" to make them recurse.
|
||||
The other list commands `lsd`,`lsf`,`lsjson` do not recurse by default - use `-R` to make them recurse.
|
||||
|
||||
Listing a non existent directory will produce an error except for
|
||||
remotes which can't have empty directories (eg s3, swift, gcs, etc -
|
||||
remotes which can't have empty directories (e.g. s3, swift, or gcs -
|
||||
the bucket based remotes).
|
||||
|
||||
|
||||
|
||||
@@ -9,10 +9,6 @@ url: /commands/rclone_mkdir/
|
||||
|
||||
Make the path if it doesn't already exist.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Make the path if it doesn't already exist.
|
||||
|
||||
```
|
||||
rclone mkdir remote:path [flags]
|
||||
```
|
||||
|
||||
@@ -18,37 +18,51 @@ FUSE.
|
||||
|
||||
First set up your remote using `rclone config`. Check it works with `rclone ls` etc.
|
||||
|
||||
You can either run mount in foreground mode or background (daemon) mode. Mount runs in
|
||||
foreground mode by default, use the --daemon flag to specify background mode behaviour.
|
||||
Background mode is only supported on Linux and OSX, you can only run mount in
|
||||
foreground mode on Windows.
|
||||
On Linux and OSX, you can either run mount in foreground mode or background (daemon) mode.
|
||||
Mount runs in foreground mode by default, use the `--daemon` flag to specify background mode.
|
||||
You can only run mount in foreground mode on Windows.
|
||||
|
||||
On Linux/macOS/FreeBSD Start the mount like this where `/path/to/local/mount`
|
||||
is an **empty** **existing** directory.
|
||||
On Linux/macOS/FreeBSD start the mount like this, where `/path/to/local/mount`
|
||||
is an **empty** **existing** directory:
|
||||
|
||||
rclone mount remote:path/to/files /path/to/local/mount
|
||||
|
||||
Or on Windows like this where `X:` is an unused drive letter
|
||||
or use a path to **non-existent** directory.
|
||||
On Windows you can start a mount in different ways. See [below](#mounting-modes-on-windows)
|
||||
for details. The following examples will mount to an automatically assigned drive,
|
||||
to specific drive letter `X:`, to path `C:\path\to\nonexistent\directory`
|
||||
(which must be **non-existent** subdirectory of an **existing** parent directory or drive,
|
||||
and is not supported when [mounting as a network drive](#mounting-modes-on-windows)), and
|
||||
the last example will mount as network share `\\cloud\remote` and map it to an
|
||||
automatically assigned drive:
|
||||
|
||||
rclone mount remote:path/to/files *
|
||||
rclone mount remote:path/to/files X:
|
||||
rclone mount remote:path/to/files C:\path\to\nonexistent\directory
|
||||
|
||||
When running in background mode the user will have to stop the mount manually (specified below).
|
||||
rclone mount remote:path/to/files \\cloud\remote
|
||||
|
||||
When the program ends while in foreground mode, either via Ctrl+C or receiving
|
||||
a SIGINT or SIGTERM signal, the mount is automatically stopped.
|
||||
a SIGINT or SIGTERM signal, the mount should be automatically stopped.
|
||||
|
||||
The umount operation can fail, for example when the mountpoint is busy.
|
||||
When that happens, it is the user's responsibility to stop the mount manually.
|
||||
|
||||
Stopping the mount manually:
|
||||
When running in background mode the user will have to stop the mount manually:
|
||||
|
||||
# Linux
|
||||
fusermount -u /path/to/local/mount
|
||||
# OS X
|
||||
umount /path/to/local/mount
|
||||
|
||||
The umount operation can fail, for example when the mountpoint is busy.
|
||||
When that happens, it is the user's responsibility to stop the mount manually.
|
||||
|
||||
The size of the mounted file system will be set according to information retrieved
|
||||
from the remote, the same as returned by the [rclone about](https://rclone.org/commands/rclone_about/)
|
||||
command. Remotes with unlimited storage may report the used size only,
|
||||
then an additional 1PB of free space is assumed. If the remote does not
|
||||
[support](https://rclone.org/overview/#optional-features) the about feature
|
||||
at all, then 1PB is set as both the total and the free size.
|
||||
|
||||
**Note**: As of `rclone` 1.52.2, `rclone mount` now requires Go version 1.13
|
||||
or newer on some platforms depending on the underlying FUSE library in use.
|
||||
|
||||
## Installing on Windows
|
||||
|
||||
To run rclone mount on Windows, you will need to
|
||||
@@ -57,10 +71,110 @@ download and install [WinFsp](http://www.secfs.net/winfsp/).
|
||||
[WinFsp](https://github.com/billziss-gh/winfsp) is an open source
|
||||
Windows File System Proxy which makes it easy to write user space file
|
||||
systems for Windows. It provides a FUSE emulation layer which rclone
|
||||
uses in combination with
|
||||
[cgofuse](https://github.com/billziss-gh/cgofuse). Both of these
|
||||
packages are by Bill Zissimopoulos who was very helpful during the
|
||||
implementation of rclone mount for Windows.
|
||||
uses combination with [cgofuse](https://github.com/billziss-gh/cgofuse).
|
||||
Both of these packages are by Bill Zissimopoulos who was very helpful
|
||||
during the implementation of rclone mount for Windows.
|
||||
|
||||
### Mounting modes on windows
|
||||
|
||||
Unlike other operating systems, Microsoft Windows provides a different filesystem
|
||||
type for network and fixed drives. It optimises access on the assumption fixed
|
||||
disk drives are fast and reliable, while network drives have relatively high latency
|
||||
and less reliability. Some settings can also be differentiated between the two types,
|
||||
for example that Windows Explorer should just display icons and not create preview
|
||||
thumbnails for image and video files on network drives.
|
||||
|
||||
In most cases, rclone will mount the remote as a normal, fixed disk drive by default.
|
||||
However, you can also choose to mount it as a remote network drive, often described
|
||||
as a network share. If you mount an rclone remote using the default, fixed drive mode
|
||||
and experience unexpected program errors, freezes or other issues, consider mounting
|
||||
as a network drive instead.
|
||||
|
||||
When mounting as a fixed disk drive you can either mount to an unused drive letter,
|
||||
or to a path - which must be **non-existent** subdirectory of an **existing** parent
|
||||
directory or drive. Using the special value `*` will tell rclone to
|
||||
automatically assign the next available drive letter, starting with Z: and moving backward.
|
||||
Examples:
|
||||
|
||||
rclone mount remote:path/to/files *
|
||||
rclone mount remote:path/to/files X:
|
||||
rclone mount remote:path/to/files C:\path\to\nonexistent\directory
|
||||
rclone mount remote:path/to/files X:
|
||||
|
||||
Option `--volname` can be used to set a custom volume name for the mounted
|
||||
file system. The default is to use the remote name and path.
|
||||
|
||||
To mount as network drive, you can add option `--network-mode`
|
||||
to your mount command. Mounting to a directory path is not supported in
|
||||
this mode, it is a limitation Windows imposes on junctions, so the remote must always
|
||||
be mounted to a drive letter.
|
||||
|
||||
rclone mount remote:path/to/files X: --network-mode
|
||||
|
||||
A volume name specified with `--volname` will be used to create the network share path.
|
||||
A complete UNC path, such as `\\cloud\remote`, optionally with path
|
||||
`\\cloud\remote\madeup\path`, will be used as is. Any other
|
||||
string will be used as the share part, after a default prefix `\\server\`.
|
||||
If no volume name is specified then `\\server\share` will be used.
|
||||
You must make sure the volume name is unique when you are mounting more than one drive,
|
||||
or else the mount command will fail. The share name will treated as the volume label for
|
||||
the mapped drive, shown in Windows Explorer etc, while the complete
|
||||
`\\server\share` will be reported as the remote UNC path by
|
||||
`net use` etc, just like a normal network drive mapping.
|
||||
|
||||
If you specify a full network share UNC path with `--volname`, this will implicitely
|
||||
set the `--network-mode` option, so the following two examples have same result:
|
||||
|
||||
rclone mount remote:path/to/files X: --network-mode
|
||||
rclone mount remote:path/to/files X: --volname \\server\share
|
||||
|
||||
You may also specify the network share UNC path as the mountpoint itself. Then rclone
|
||||
will automatically assign a drive letter, same as with `*` and use that as
|
||||
mountpoint, and instead use the UNC path specified as the volume name, as if it were
|
||||
specified with the `--volname` option. This will also implicitely set
|
||||
the `--network-mode` option. This means the following two examples have same result:
|
||||
|
||||
rclone mount remote:path/to/files \\cloud\remote
|
||||
rclone mount remote:path/to/files * --volname \\cloud\remote
|
||||
|
||||
There is yet another way to enable network mode, and to set the share path,
|
||||
and that is to pass the "native" libfuse/WinFsp option directly:
|
||||
`--fuse-flag --VolumePrefix=\server\share`. Note that the path
|
||||
must be with just a single backslash prefix in this case.
|
||||
|
||||
|
||||
*Note:* In previous versions of rclone this was the only supported method.
|
||||
|
||||
[Read more about drive mapping](https://en.wikipedia.org/wiki/Drive_mapping)
|
||||
|
||||
See also [Limitations](#limitations) section below.
|
||||
|
||||
### Windows filesystem permissions
|
||||
|
||||
The FUSE emulation layer on Windows must convert between the POSIX-based
|
||||
permission model used in FUSE, and the permission model used in Windows,
|
||||
based on access-control lists (ACL).
|
||||
|
||||
The mounted filesystem will normally get three entries in its access-control list (ACL),
|
||||
representing permissions for the POSIX permission scopes: Owner, group and others.
|
||||
By default, the owner and group will be taken from the current user, and the built-in
|
||||
group "Everyone" will be used to represent others. The user/group can be customized
|
||||
with FUSE options "UserName" and "GroupName",
|
||||
e.g. `-o UserName=user123 -o GroupName="Authenticated Users"`.
|
||||
|
||||
The permissions on each entry will be set according to
|
||||
[options](#options) `--dir-perms` and `--file-perms`,
|
||||
which takes a value in traditional [numeric notation](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation),
|
||||
where the default corresponds to `--file-perms 0666 --dir-perms 0777`.
|
||||
|
||||
Note that the mapping of permissions is not always trivial, and the result
|
||||
you see in Windows Explorer may not be exactly like you expected.
|
||||
For example, when setting a value that includes write access, this will be
|
||||
mapped to individual permissions "write attributes", "write data" and "append data",
|
||||
but not "write extended attributes" (WinFsp does not support extended attributes,
|
||||
see [this](https://github.com/billziss-gh/winfsp/wiki/NTFS-Compatibility)).
|
||||
Windows will then show this as basic permission "Special" instead of "Write",
|
||||
because "Write" includes the "write extended attributes" permission.
|
||||
|
||||
### Windows caveats
|
||||
|
||||
@@ -78,43 +192,15 @@ infrastructure](https://github.com/billziss-gh/winfsp/wiki/WinFsp-Service-Archit
|
||||
which creates drives accessible for everyone on the system or
|
||||
alternatively using [the nssm service manager](https://nssm.cc/usage).
|
||||
|
||||
### Mount as a network drive
|
||||
|
||||
By default, rclone will mount the remote as a normal drive. However,
|
||||
you can also mount it as a **Network Drive** (or **Network Share**, as
|
||||
mentioned in some places)
|
||||
|
||||
Unlike other systems, Windows provides a different filesystem type for
|
||||
network drives. Windows and other programs treat the network drives
|
||||
and fixed/removable drives differently: In network drives, many I/O
|
||||
operations are optimized, as the high latency and low reliability
|
||||
(compared to a normal drive) of a network is expected.
|
||||
|
||||
Although many people prefer network shares to be mounted as normal
|
||||
system drives, this might cause some issues, such as programs not
|
||||
working as expected or freezes and errors while operating with the
|
||||
mounted remote in Windows Explorer. If you experience any of those,
|
||||
consider mounting rclone remotes as network shares, as Windows expects
|
||||
normal drives to be fast and reliable, while cloud storage is far from
|
||||
that. See also [Limitations](#limitations) section below for more
|
||||
info
|
||||
|
||||
Add "--fuse-flag --VolumePrefix=\server\share" to your "mount"
|
||||
command, **replacing "share" with any other name of your choice if you
|
||||
are mounting more than one remote**. Otherwise, the mountpoints will
|
||||
conflict and your mounted filesystems will overlap.
|
||||
|
||||
[Read more about drive mapping](https://en.wikipedia.org/wiki/Drive_mapping)
|
||||
|
||||
## Limitations
|
||||
|
||||
Without the use of "--vfs-cache-mode" this can only write files
|
||||
Without the use of `--vfs-cache-mode` this can only write files
|
||||
sequentially, it can only seek when reading. This means that many
|
||||
applications won't work with their files on an rclone mount without
|
||||
"--vfs-cache-mode writes" or "--vfs-cache-mode full". See the [File
|
||||
Caching](#vfs-file-caching) section for more info.
|
||||
`--vfs-cache-mode writes` or `--vfs-cache-mode full`.
|
||||
See the [File Caching](#file-caching) section for more info.
|
||||
|
||||
The bucket based remotes (eg Swift, S3, Google Compute Storage, B2,
|
||||
The bucket based remotes (e.g. Swift, S3, Google Compute Storage, B2,
|
||||
Hubic) do not support the concept of empty directories, so empty
|
||||
directories will have a tendency to disappear once they fall out of
|
||||
the directory cache.
|
||||
@@ -127,15 +213,15 @@ File systems expect things to be 100% reliable, whereas cloud storage
|
||||
systems are a long way from 100% reliable. The rclone sync/copy
|
||||
commands cope with this with lots of retries. However rclone mount
|
||||
can't use retries in the same way without making local copies of the
|
||||
uploads. Look at the [file caching](#vfs-file-caching)
|
||||
uploads. Look at the [file caching](#file-caching)
|
||||
for solutions to make mount more reliable.
|
||||
|
||||
## Attribute caching
|
||||
|
||||
You can use the flag --attr-timeout to set the time the kernel caches
|
||||
the attributes (size, modification time etc) for directory entries.
|
||||
You can use the flag `--attr-timeout` to set the time the kernel caches
|
||||
the attributes (size, modification time, etc.) for directory entries.
|
||||
|
||||
The default is "1s" which caches files just long enough to avoid
|
||||
The default is `1s` which caches files just long enough to avoid
|
||||
too many callbacks to rclone from the kernel.
|
||||
|
||||
In theory 0s should be the correct value for filesystems which can
|
||||
@@ -146,14 +232,14 @@ few problems such as
|
||||
and [excessive time listing directories](https://github.com/rclone/rclone/issues/2095#issuecomment-371141147).
|
||||
|
||||
The kernel can cache the info about a file for the time given by
|
||||
"--attr-timeout". You may see corruption if the remote file changes
|
||||
`--attr-timeout`. You may see corruption if the remote file changes
|
||||
length during this window. It will show up as either a truncated file
|
||||
or a file with garbage on the end. With "--attr-timeout 1s" this is
|
||||
very unlikely but not impossible. The higher you set "--attr-timeout"
|
||||
or a file with garbage on the end. With `--attr-timeout 1s` this is
|
||||
very unlikely but not impossible. The higher you set `--attr-timeout`
|
||||
the more likely it is. The default setting of "1s" is the lowest
|
||||
setting which mitigates the problems above.
|
||||
|
||||
If you set it higher ('10s' or '1m' say) then the kernel will call
|
||||
If you set it higher (`10s` or `1m` say) then the kernel will call
|
||||
back to rclone less often making it more efficient, however there is
|
||||
more chance of the corruption issue above.
|
||||
|
||||
@@ -164,7 +250,7 @@ This is the same as setting the attr_timeout option in mount.fuse.
|
||||
|
||||
## Filters
|
||||
|
||||
Rclone's filters can be used to select a subset of the
|
||||
Note that all the rclone filters can be used to select a subset of the
|
||||
files to be visible in the mount.
|
||||
|
||||
## systemd
|
||||
@@ -175,28 +261,25 @@ after the mountpoint has been successfully set up.
|
||||
Units having the rclone mount service specified as a requirement
|
||||
will see all files and folders immediately in this mode.
|
||||
|
||||
## chunked reading ###
|
||||
## chunked reading
|
||||
|
||||
--vfs-read-chunk-size will enable reading the source objects in parts.
|
||||
`--vfs-read-chunk-size` will enable reading the source objects in parts.
|
||||
This can reduce the used download quota for some remotes by requesting only chunks
|
||||
from the remote that are actually read at the cost of an increased number of requests.
|
||||
|
||||
When --vfs-read-chunk-size-limit is also specified and greater than --vfs-read-chunk-size,
|
||||
the chunk size for each open file will get doubled for each chunk read, until the
|
||||
specified value is reached. A value of -1 will disable the limit and the chunk size will
|
||||
grow indefinitely.
|
||||
When `--vfs-read-chunk-size-limit` is also specified and greater than
|
||||
`--vfs-read-chunk-size`, the chunk size for each open file will get doubled
|
||||
for each chunk read, until the specified value is reached. A value of `-1` will disable
|
||||
the limit and the chunk size will grow indefinitely.
|
||||
|
||||
With --vfs-read-chunk-size 100M and --vfs-read-chunk-size-limit 0 the following
|
||||
parts will be downloaded: 0-100M, 100M-200M, 200M-300M, 300M-400M and so on.
|
||||
When --vfs-read-chunk-size-limit 500M is specified, the result would be
|
||||
With `--vfs-read-chunk-size 100M` and `--vfs-read-chunk-size-limit 0`
|
||||
the following parts will be downloaded: 0-100M, 100M-200M, 200M-300M, 300M-400M and so on.
|
||||
When `--vfs-read-chunk-size-limit 500M` is specified, the result would be
|
||||
0-100M, 100M-300M, 300M-700M, 700M-1200M, 1200M-1700M and so on.
|
||||
|
||||
Chunked reading will only work with --vfs-cache-mode < full, as the file will always
|
||||
be copied to the vfs cache before opening with --vfs-cache-mode full.
|
||||
|
||||
## VFS - Virtual File System
|
||||
|
||||
Mount uses rclone's VFS layer. This adapts the cloud storage objects
|
||||
This command uses the VFS layer. This adapts the cloud storage objects
|
||||
that rclone uses into something which looks much more like a disk
|
||||
filing system.
|
||||
|
||||
@@ -290,9 +373,9 @@ second. If rclone is quit or dies with files that haven't been
|
||||
uploaded, these will be uploaded next time rclone is run with the same
|
||||
flags.
|
||||
|
||||
If using --vfs-cache-max-size note that the cache may exceed this size
|
||||
If using `--vfs-cache-max-size` note that the cache may exceed this size
|
||||
for two reasons. Firstly because it is only checked every
|
||||
--vfs-cache-poll-interval. Secondly because open files cannot be
|
||||
`--vfs-cache-poll-interval`. Secondly because open files cannot be
|
||||
evicted from the cache.
|
||||
|
||||
### --vfs-cache-mode off
|
||||
@@ -340,7 +423,7 @@ In this mode all reads and writes are buffered to and from disk. When
|
||||
data is read from the remote this is buffered to disk as well.
|
||||
|
||||
In this mode the files in the cache will be sparse files and rclone
|
||||
will keep track of which bits of the files it has dowloaded.
|
||||
will keep track of which bits of the files it has downloaded.
|
||||
|
||||
So if an application only reads the starts of each file, then rclone
|
||||
will only buffer the start of the file. These files will appear to be
|
||||
@@ -357,6 +440,11 @@ whereas the --vfs-read-ahead is buffered on disk.
|
||||
When using this mode it is recommended that --buffer-size is not set
|
||||
too big and --vfs-read-ahead is set large if required.
|
||||
|
||||
**IMPORTANT** not all file systems support sparse files. In particular
|
||||
FAT/exFAT do not. Rclone will perform very badly if the cache
|
||||
directory is on a filesystem which doesn't support sparse files and it
|
||||
will log an ERROR message if one is detected.
|
||||
|
||||
## VFS Performance
|
||||
|
||||
These flags may be used to enable/disable features of the VFS for
|
||||
@@ -392,6 +480,12 @@ on disk cache file.
|
||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking. (default 20ms)
|
||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error. (default 1s)
|
||||
|
||||
When using VFS write caching (--vfs-cache-mode with value writes or full),
|
||||
the global flag --transfers can be set to adjust the number of parallel uploads of
|
||||
modified files from cache (the related global flag --checkers have no effect on mount).
|
||||
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
|
||||
## VFS Case Sensitivity
|
||||
|
||||
Linux file systems are case-sensitive: two files can differ only
|
||||
@@ -405,7 +499,7 @@ It is not allowed for two files in the same directory to differ only by case.
|
||||
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
||||
file systems case-sensitive but that is not the default
|
||||
|
||||
The "--vfs-case-insensitive" mount flag controls how rclone handles these
|
||||
The `--vfs-case-insensitive` mount flag controls how rclone handles these
|
||||
two cases. If its value is "false", rclone passes file names to the mounted
|
||||
file system as-is. If the flag is "true" (or appears without a value on
|
||||
command line), rclone may perform a "fixup" as explained below.
|
||||
@@ -435,30 +529,33 @@ rclone mount remote:path /path/to/mountpoint [flags]
|
||||
## Options
|
||||
|
||||
```
|
||||
--allow-non-empty Allow mounting over a non-empty directory (not Windows).
|
||||
--allow-other Allow access to other users.
|
||||
--allow-root Allow access to root user.
|
||||
--async-read Use asynchronous reads. (default true)
|
||||
--allow-non-empty Allow mounting over a non-empty directory. Not supported on Windows.
|
||||
--allow-other Allow access to other users. Not supported on Windows.
|
||||
--allow-root Allow access to root user. Not supported on Windows.
|
||||
--async-read Use asynchronous reads. Not supported on Windows. (default true)
|
||||
--attr-timeout duration Time for which file/directory attributes are cached. (default 1s)
|
||||
--daemon Run mount as a daemon (background mode).
|
||||
--daemon-timeout duration Time limit for rclone to respond to kernel (not supported by all OSes).
|
||||
--daemon Run mount as a daemon (background mode). Not supported on Windows.
|
||||
--daemon-timeout duration Time limit for rclone to respond to kernel. Not supported on Windows.
|
||||
--debug-fuse Debug the FUSE internals - needs -v.
|
||||
--default-permissions Makes kernel enforce access control based on the file mode.
|
||||
--default-permissions Makes kernel enforce access control based on the file mode. Not supported on Windows.
|
||||
--dir-cache-time duration Time to cache directory entries for. (default 5m0s)
|
||||
--dir-perms FileMode Directory permissions (default 0777)
|
||||
--file-perms FileMode File permissions (default 0666)
|
||||
--fuse-flag stringArray Flags or arguments to be passed direct to libfuse/WinFsp. Repeat if required.
|
||||
--gid uint32 Override the gid field set by the filesystem. (default 1000)
|
||||
--gid uint32 Override the gid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
-h, --help help for mount
|
||||
--max-read-ahead SizeSuffix The number of bytes that can be prefetched for sequential reads. (default 128k)
|
||||
--max-read-ahead SizeSuffix The number of bytes that can be prefetched for sequential reads. Not supported on Windows. (default 128k)
|
||||
--network-mode Mount as remote network drive, instead of fixed disk drive. Supported on Windows only
|
||||
--no-checksum Don't compare checksums on up/download.
|
||||
--no-modtime Don't read/write the modification time (can speed things up).
|
||||
--no-seek Don't allow seeking in files.
|
||||
--noappledouble Ignore Apple Double (._) and .DS_Store files. Supported on OSX only. (default true)
|
||||
--noapplexattr Ignore all "com.apple.*" extended attributes. Supported on OSX only.
|
||||
-o, --option stringArray Option for libfuse/WinFsp. Repeat if required.
|
||||
--poll-interval duration Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable. (default 1m0s)
|
||||
--read-only Mount read-only.
|
||||
--uid uint32 Override the uid field set by the filesystem. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem.
|
||||
--uid uint32 Override the uid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. Not supported on Windows.
|
||||
--vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s)
|
||||
--vfs-cache-max-size SizeSuffix Max total size of objects in the cache. (default off)
|
||||
--vfs-cache-mode CacheMode Cache mode off|minimal|writes|full (default off)
|
||||
@@ -470,8 +567,8 @@ rclone mount remote:path /path/to/mountpoint [flags]
|
||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking. (default 20ms)
|
||||
--vfs-write-back duration Time to writeback files after last use when using cache. (default 5s)
|
||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error. (default 1s)
|
||||
--volname string Set the volume name (not supported by all OSes).
|
||||
--write-back-cache Makes kernel buffer writes before sending them to rclone. Without this, writethrough caching is used.
|
||||
--volname string Set the volume name. Supported on Windows and OSX only.
|
||||
--write-back-cache Makes kernel buffer writes before sending them to rclone. Without this, writethrough caching is used. Not supported on Windows.
|
||||
```
|
||||
|
||||
See the [global flags page](/flags/) for global options not listed here.
|
||||
|
||||
@@ -14,15 +14,15 @@ Move files from source to dest.
|
||||
|
||||
Moves the contents of the source directory to the destination
|
||||
directory. Rclone will error if the source and destination overlap and
|
||||
the remote does not support a server side directory move operation.
|
||||
the remote does not support a server-side directory move operation.
|
||||
|
||||
If no filters are in use and if possible this will server side move
|
||||
If no filters are in use and if possible this will server-side move
|
||||
`source:path` into `dest:path`. After this `source:path` will no
|
||||
longer exist.
|
||||
|
||||
Otherwise for each file in `source:path` selected by the filters (if
|
||||
any) this will move it into `dest:path`. If possible a server side
|
||||
move will be used, otherwise it will copy it (server side if possible)
|
||||
any) this will move it into `dest:path`. If possible a server-side
|
||||
move will be used, otherwise it will copy it (server-side if possible)
|
||||
into `dest:path` then delete the original (if no errors on copy) in
|
||||
`source:path`.
|
||||
|
||||
|
||||
@@ -30,9 +30,10 @@ Here are the keys - press '?' to toggle the help on and off
|
||||
←,h to return
|
||||
c toggle counts
|
||||
g toggle graph
|
||||
n,s,C sort by name,size,count
|
||||
a toggle average size in directory
|
||||
n,s,C,A sort by name,size,count,average size
|
||||
d delete file/directory
|
||||
y copy current path to clipbard
|
||||
y copy current path to clipboard
|
||||
Y display current path
|
||||
^L refresh screen
|
||||
? to toggle help on and off
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
---
|
||||
title: "rclone obscure"
|
||||
description: "Obscure password for use in the rclone config file"
|
||||
description: "Obscure password for use in the rclone config file."
|
||||
slug: rclone_obscure
|
||||
url: /commands/rclone_obscure/
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/obscure/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone obscure
|
||||
|
||||
Obscure password for use in the rclone config file
|
||||
Obscure password for use in the rclone config file.
|
||||
|
||||
## Synopsis
|
||||
|
||||
@@ -23,7 +23,8 @@ the config file. However it is very hard to shoulder surf a 64
|
||||
character hex token.
|
||||
|
||||
This command can also accept a password through STDIN instead of an
|
||||
argument by passing a hyphen as an argument. Example:
|
||||
argument by passing a hyphen as an argument. This will use the first
|
||||
line of STDIN as the password not including the trailing newline.
|
||||
|
||||
echo "secretpassword" | rclone obscure -
|
||||
|
||||
|
||||
@@ -13,8 +13,9 @@ Remove the path and all of its contents.
|
||||
|
||||
|
||||
Remove the path and all of its contents. Note that this does not obey
|
||||
include/exclude filters - everything will be removed. Use `delete` if
|
||||
you want to selectively delete files.
|
||||
include/exclude filters - everything will be removed. Use the `delete`
|
||||
command if you want to selectively delete files. To delete empty directories only,
|
||||
use command `rmdir` or `rmdirs`.
|
||||
|
||||
**Important**: Since this can cause data loss, test first with the
|
||||
`--dry-run` or the `--interactive`/`-i` flag.
|
||||
|
||||
@@ -56,7 +56,7 @@ Will place this in the "arg" value
|
||||
|
||||
Use --loopback to connect to the rclone instance running "rclone rc".
|
||||
This is very useful for testing commands without having to run an
|
||||
rclone rc server, eg:
|
||||
rclone rc server, e.g.:
|
||||
|
||||
rclone rc --loopback operations/about fs=/
|
||||
|
||||
@@ -73,7 +73,7 @@ rclone rc commands parameter [flags]
|
||||
-h, --help help for rc
|
||||
--json string Input JSON - use instead of key=value args.
|
||||
--loopback If set connect to this rclone instance not via HTTP.
|
||||
--no-output If set don't output the JSON result.
|
||||
--no-output If set, don't output the JSON result.
|
||||
-o, --opt stringArray Option in the form name=value or name placed in the "opt" array.
|
||||
--pass string Password to use to connect to rclone remote control.
|
||||
--url string URL to connect to rclone remote control. (default "http://localhost:5572/")
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
---
|
||||
title: "rclone rmdir"
|
||||
description: "Remove the path if empty."
|
||||
description: "Remove the empty directory at path."
|
||||
slug: rclone_rmdir
|
||||
url: /commands/rclone_rmdir/
|
||||
# autogenerated - DO NOT EDIT, instead edit the source code in cmd/rmdir/ and as part of making a release run "make commanddocs"
|
||||
---
|
||||
# rclone rmdir
|
||||
|
||||
Remove the path if empty.
|
||||
Remove the empty directory at path.
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
Remove the path. Note that you can't remove a path with
|
||||
objects in it, use purge for that.
|
||||
This removes empty directory given by path. Will not remove the path if it
|
||||
has any objects in it, not even empty subdirectories. Use
|
||||
command `rmdirs` (or `delete` with option `--rmdirs`)
|
||||
to do that.
|
||||
|
||||
To delete a path and any objects in it, use `purge` command.
|
||||
|
||||
|
||||
```
|
||||
rclone rmdir remote:path [flags]
|
||||
|
||||
@@ -11,15 +11,21 @@ Remove empty directories under the path.
|
||||
|
||||
## Synopsis
|
||||
|
||||
This removes any empty directories (or directories that only contain
|
||||
empty directories) under the path that it finds, including the path if
|
||||
it has nothing in.
|
||||
|
||||
If you supply the --leave-root flag, it will not remove the root directory.
|
||||
This recursively removes any empty directories (including directories
|
||||
that only contain empty directories), that it finds under the path.
|
||||
The root path itself will also be removed if it is empty, unless
|
||||
you supply the `--leave-root` flag.
|
||||
|
||||
Use command `rmdir` to delete just the empty directory
|
||||
given by path, not recurse.
|
||||
|
||||
This is useful for tidying up remotes that rclone has left a lot of
|
||||
empty directories in.
|
||||
empty directories in. For example the `delete` command will
|
||||
delete files but leave the directory structure (unless used with
|
||||
option `--rmdirs`).
|
||||
|
||||
To delete a path and any objects in it, use `purge` command.
|
||||
|
||||
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@ Serve a remote over a protocol.
|
||||
## Synopsis
|
||||
|
||||
rclone serve is used to serve a remote over a given protocol. This
|
||||
command requires the use of a subcommand to specify the protocol, eg
|
||||
command requires the use of a subcommand to specify the protocol, e.g.
|
||||
|
||||
rclone serve http remote:
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ players might show files that they are not able to play back correctly.
|
||||
## Server options
|
||||
|
||||
Use `--addr` to specify which IP address and port the server should
|
||||
listen on, eg `--addr 1.2.3.4:8000` or `--addr :8080` to listen to all
|
||||
listen on, e.g. `--addr 1.2.3.4:8000` or `--addr :8080` to listen to all
|
||||
IPs.
|
||||
|
||||
Use `--name` to choose the friendly server name, which is by
|
||||
@@ -129,9 +129,9 @@ second. If rclone is quit or dies with files that haven't been
|
||||
uploaded, these will be uploaded next time rclone is run with the same
|
||||
flags.
|
||||
|
||||
If using --vfs-cache-max-size note that the cache may exceed this size
|
||||
If using `--vfs-cache-max-size` note that the cache may exceed this size
|
||||
for two reasons. Firstly because it is only checked every
|
||||
--vfs-cache-poll-interval. Secondly because open files cannot be
|
||||
`--vfs-cache-poll-interval`. Secondly because open files cannot be
|
||||
evicted from the cache.
|
||||
|
||||
### --vfs-cache-mode off
|
||||
@@ -179,7 +179,7 @@ In this mode all reads and writes are buffered to and from disk. When
|
||||
data is read from the remote this is buffered to disk as well.
|
||||
|
||||
In this mode the files in the cache will be sparse files and rclone
|
||||
will keep track of which bits of the files it has dowloaded.
|
||||
will keep track of which bits of the files it has downloaded.
|
||||
|
||||
So if an application only reads the starts of each file, then rclone
|
||||
will only buffer the start of the file. These files will appear to be
|
||||
@@ -196,6 +196,11 @@ whereas the --vfs-read-ahead is buffered on disk.
|
||||
When using this mode it is recommended that --buffer-size is not set
|
||||
too big and --vfs-read-ahead is set large if required.
|
||||
|
||||
**IMPORTANT** not all file systems support sparse files. In particular
|
||||
FAT/exFAT do not. Rclone will perform very badly if the cache
|
||||
directory is on a filesystem which doesn't support sparse files and it
|
||||
will log an ERROR message if one is detected.
|
||||
|
||||
## VFS Performance
|
||||
|
||||
These flags may be used to enable/disable features of the VFS for
|
||||
@@ -231,6 +236,12 @@ on disk cache file.
|
||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking. (default 20ms)
|
||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error. (default 1s)
|
||||
|
||||
When using VFS write caching (--vfs-cache-mode with value writes or full),
|
||||
the global flag --transfers can be set to adjust the number of parallel uploads of
|
||||
modified files from cache (the related global flag --checkers have no effect on mount).
|
||||
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
|
||||
## VFS Case Sensitivity
|
||||
|
||||
Linux file systems are case-sensitive: two files can differ only
|
||||
@@ -244,7 +255,7 @@ It is not allowed for two files in the same directory to differ only by case.
|
||||
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
||||
file systems case-sensitive but that is not the default
|
||||
|
||||
The "--vfs-case-insensitive" mount flag controls how rclone handles these
|
||||
The `--vfs-case-insensitive` mount flag controls how rclone handles these
|
||||
two cases. If its value is "false", rclone passes file names to the mounted
|
||||
file system as-is. If the flag is "true" (or appears without a value on
|
||||
command line), rclone may perform a "fixup" as explained below.
|
||||
@@ -278,7 +289,7 @@ rclone serve dlna remote:path [flags]
|
||||
--dir-cache-time duration Time to cache directory entries for. (default 5m0s)
|
||||
--dir-perms FileMode Directory permissions (default 0777)
|
||||
--file-perms FileMode File permissions (default 0666)
|
||||
--gid uint32 Override the gid field set by the filesystem. (default 1000)
|
||||
--gid uint32 Override the gid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
-h, --help help for dlna
|
||||
--log-trace enable trace logging of SOAP traffic
|
||||
--name string name of DLNA server
|
||||
@@ -287,8 +298,8 @@ rclone serve dlna remote:path [flags]
|
||||
--no-seek Don't allow seeking in files.
|
||||
--poll-interval duration Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable. (default 1m0s)
|
||||
--read-only Mount read-only.
|
||||
--uid uint32 Override the uid field set by the filesystem. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. (default 2)
|
||||
--uid uint32 Override the uid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. Not supported on Windows. (default 2)
|
||||
--vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s)
|
||||
--vfs-cache-max-size SizeSuffix Max total size of objects in the cache. (default off)
|
||||
--vfs-cache-mode CacheMode Cache mode off|minimal|writes|full (default off)
|
||||
|
||||
@@ -19,7 +19,7 @@ or you can make a remote of type ftp to read and write it.
|
||||
## Server options
|
||||
|
||||
Use --addr to specify which IP address and port the server should
|
||||
listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
listen on, e.g. --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
IPs. By default it only listens on localhost. You can use port
|
||||
:0 to let the OS choose an available port.
|
||||
|
||||
@@ -128,9 +128,9 @@ second. If rclone is quit or dies with files that haven't been
|
||||
uploaded, these will be uploaded next time rclone is run with the same
|
||||
flags.
|
||||
|
||||
If using --vfs-cache-max-size note that the cache may exceed this size
|
||||
If using `--vfs-cache-max-size` note that the cache may exceed this size
|
||||
for two reasons. Firstly because it is only checked every
|
||||
--vfs-cache-poll-interval. Secondly because open files cannot be
|
||||
`--vfs-cache-poll-interval`. Secondly because open files cannot be
|
||||
evicted from the cache.
|
||||
|
||||
### --vfs-cache-mode off
|
||||
@@ -178,7 +178,7 @@ In this mode all reads and writes are buffered to and from disk. When
|
||||
data is read from the remote this is buffered to disk as well.
|
||||
|
||||
In this mode the files in the cache will be sparse files and rclone
|
||||
will keep track of which bits of the files it has dowloaded.
|
||||
will keep track of which bits of the files it has downloaded.
|
||||
|
||||
So if an application only reads the starts of each file, then rclone
|
||||
will only buffer the start of the file. These files will appear to be
|
||||
@@ -195,6 +195,11 @@ whereas the --vfs-read-ahead is buffered on disk.
|
||||
When using this mode it is recommended that --buffer-size is not set
|
||||
too big and --vfs-read-ahead is set large if required.
|
||||
|
||||
**IMPORTANT** not all file systems support sparse files. In particular
|
||||
FAT/exFAT do not. Rclone will perform very badly if the cache
|
||||
directory is on a filesystem which doesn't support sparse files and it
|
||||
will log an ERROR message if one is detected.
|
||||
|
||||
## VFS Performance
|
||||
|
||||
These flags may be used to enable/disable features of the VFS for
|
||||
@@ -230,6 +235,12 @@ on disk cache file.
|
||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking. (default 20ms)
|
||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error. (default 1s)
|
||||
|
||||
When using VFS write caching (--vfs-cache-mode with value writes or full),
|
||||
the global flag --transfers can be set to adjust the number of parallel uploads of
|
||||
modified files from cache (the related global flag --checkers have no effect on mount).
|
||||
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
|
||||
## VFS Case Sensitivity
|
||||
|
||||
Linux file systems are case-sensitive: two files can differ only
|
||||
@@ -243,7 +254,7 @@ It is not allowed for two files in the same directory to differ only by case.
|
||||
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
||||
file systems case-sensitive but that is not the default
|
||||
|
||||
The "--vfs-case-insensitive" mount flag controls how rclone handles these
|
||||
The `--vfs-case-insensitive` mount flag controls how rclone handles these
|
||||
two cases. If its value is "false", rclone passes file names to the mounted
|
||||
file system as-is. If the flag is "true" (or appears without a value on
|
||||
command line), rclone may perform a "fixup" as explained below.
|
||||
@@ -270,7 +281,7 @@ otherwise. If the flag is provided without a value, then it is "true".
|
||||
If you supply the parameter `--auth-proxy /path/to/program` then
|
||||
rclone will use that program to generate backends on the fly which
|
||||
then are used to authenticate incoming requests. This uses a simple
|
||||
JSON based protocl with input on STDIN and output on STDOUT.
|
||||
JSON based protocol with input on STDIN and output on STDOUT.
|
||||
|
||||
**PLEASE NOTE:** `--auth-proxy` and `--authorized-keys` cannot be used
|
||||
together, if `--auth-proxy` is set the authorized keys option will be
|
||||
@@ -356,11 +367,13 @@ rclone serve ftp remote:path [flags]
|
||||
```
|
||||
--addr string IPaddress:Port or :Port to bind server to. (default "localhost:2121")
|
||||
--auth-proxy string A program to use to create the backend from the auth.
|
||||
--cert string TLS PEM key (concatenation of certificate and CA certificate)
|
||||
--dir-cache-time duration Time to cache directory entries for. (default 5m0s)
|
||||
--dir-perms FileMode Directory permissions (default 0777)
|
||||
--file-perms FileMode File permissions (default 0666)
|
||||
--gid uint32 Override the gid field set by the filesystem. (default 1000)
|
||||
--gid uint32 Override the gid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
-h, --help help for ftp
|
||||
--key string TLS PEM Private key
|
||||
--no-checksum Don't compare checksums on up/download.
|
||||
--no-modtime Don't read/write the modification time (can speed things up).
|
||||
--no-seek Don't allow seeking in files.
|
||||
@@ -369,8 +382,8 @@ rclone serve ftp remote:path [flags]
|
||||
--poll-interval duration Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable. (default 1m0s)
|
||||
--public-ip string Public IP address to advertise for passive connections.
|
||||
--read-only Mount read-only.
|
||||
--uid uint32 Override the uid field set by the filesystem. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. (default 2)
|
||||
--uid uint32 Override the uid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. Not supported on Windows. (default 2)
|
||||
--user string User name for authentication. (default "anonymous")
|
||||
--vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s)
|
||||
--vfs-cache-max-size SizeSuffix Max total size of objects in the cache. (default off)
|
||||
|
||||
@@ -15,7 +15,7 @@ rclone serve http implements a basic web server to serve the remote
|
||||
over HTTP. This can be viewed in a web browser or you can make a
|
||||
remote of type http read from it.
|
||||
|
||||
You can use the filter flags (eg --include, --exclude) to control what
|
||||
You can use the filter flags (e.g. --include, --exclude) to control what
|
||||
is served.
|
||||
|
||||
The server will log errors. Use -v to see access logs.
|
||||
@@ -26,7 +26,7 @@ control the stats printing.
|
||||
## Server options
|
||||
|
||||
Use --addr to specify which IP address and port the server should
|
||||
listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
listen on, e.g. --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
IPs. By default it only listens on localhost. You can use port
|
||||
:0 to let the OS choose an available port.
|
||||
|
||||
@@ -57,7 +57,7 @@ to be used within the template to server pages:
|
||||
| .Name | The full path of a file/directory. |
|
||||
| .Title | Directory listing of .Name |
|
||||
| .Sort | The current sort used. This is changeable via ?sort= parameter |
|
||||
| | Sort Options: namedirfist,name,size,time (default namedirfirst) |
|
||||
| | Sort Options: namedirfirst,name,size,time (default namedirfirst) |
|
||||
| .Order | The current ordering used. This is changeable via ?order= parameter |
|
||||
| | Order Options: asc,desc (default asc) |
|
||||
| .Query | Currently unused. |
|
||||
@@ -200,9 +200,9 @@ second. If rclone is quit or dies with files that haven't been
|
||||
uploaded, these will be uploaded next time rclone is run with the same
|
||||
flags.
|
||||
|
||||
If using --vfs-cache-max-size note that the cache may exceed this size
|
||||
If using `--vfs-cache-max-size` note that the cache may exceed this size
|
||||
for two reasons. Firstly because it is only checked every
|
||||
--vfs-cache-poll-interval. Secondly because open files cannot be
|
||||
`--vfs-cache-poll-interval`. Secondly because open files cannot be
|
||||
evicted from the cache.
|
||||
|
||||
### --vfs-cache-mode off
|
||||
@@ -250,7 +250,7 @@ In this mode all reads and writes are buffered to and from disk. When
|
||||
data is read from the remote this is buffered to disk as well.
|
||||
|
||||
In this mode the files in the cache will be sparse files and rclone
|
||||
will keep track of which bits of the files it has dowloaded.
|
||||
will keep track of which bits of the files it has downloaded.
|
||||
|
||||
So if an application only reads the starts of each file, then rclone
|
||||
will only buffer the start of the file. These files will appear to be
|
||||
@@ -267,6 +267,11 @@ whereas the --vfs-read-ahead is buffered on disk.
|
||||
When using this mode it is recommended that --buffer-size is not set
|
||||
too big and --vfs-read-ahead is set large if required.
|
||||
|
||||
**IMPORTANT** not all file systems support sparse files. In particular
|
||||
FAT/exFAT do not. Rclone will perform very badly if the cache
|
||||
directory is on a filesystem which doesn't support sparse files and it
|
||||
will log an ERROR message if one is detected.
|
||||
|
||||
## VFS Performance
|
||||
|
||||
These flags may be used to enable/disable features of the VFS for
|
||||
@@ -302,6 +307,12 @@ on disk cache file.
|
||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking. (default 20ms)
|
||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error. (default 1s)
|
||||
|
||||
When using VFS write caching (--vfs-cache-mode with value writes or full),
|
||||
the global flag --transfers can be set to adjust the number of parallel uploads of
|
||||
modified files from cache (the related global flag --checkers have no effect on mount).
|
||||
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
|
||||
## VFS Case Sensitivity
|
||||
|
||||
Linux file systems are case-sensitive: two files can differ only
|
||||
@@ -315,7 +326,7 @@ It is not allowed for two files in the same directory to differ only by case.
|
||||
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
||||
file systems case-sensitive but that is not the default
|
||||
|
||||
The "--vfs-case-insensitive" mount flag controls how rclone handles these
|
||||
The `--vfs-case-insensitive` mount flag controls how rclone handles these
|
||||
two cases. If its value is "false", rclone passes file names to the mounted
|
||||
file system as-is. If the flag is "true" (or appears without a value on
|
||||
command line), rclone may perform a "fixup" as explained below.
|
||||
@@ -352,7 +363,7 @@ rclone serve http remote:path [flags]
|
||||
--dir-cache-time duration Time to cache directory entries for. (default 5m0s)
|
||||
--dir-perms FileMode Directory permissions (default 0777)
|
||||
--file-perms FileMode File permissions (default 0666)
|
||||
--gid uint32 Override the gid field set by the filesystem. (default 1000)
|
||||
--gid uint32 Override the gid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
-h, --help help for http
|
||||
--htpasswd string htpasswd file - if not provided no authentication is done
|
||||
--key string SSL PEM Private key
|
||||
@@ -367,8 +378,8 @@ rclone serve http remote:path [flags]
|
||||
--server-read-timeout duration Timeout for server reading data (default 1h0m0s)
|
||||
--server-write-timeout duration Timeout for server writing data (default 1h0m0s)
|
||||
--template string User Specified Template.
|
||||
--uid uint32 Override the uid field set by the filesystem. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. (default 2)
|
||||
--uid uint32 Override the uid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. Not supported on Windows. (default 2)
|
||||
--user string User name for authentication.
|
||||
--vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s)
|
||||
--vfs-cache-max-size SizeSuffix Max total size of objects in the cache. (default off)
|
||||
|
||||
@@ -44,6 +44,10 @@ with use of the "--addr" flag.
|
||||
|
||||
You might wish to start this server on boot.
|
||||
|
||||
Adding --cache-objects=false will cause rclone to stop caching objects
|
||||
returned from the List call. Caching is normally desirable as it speeds
|
||||
up downloading objects, saves transactions and uses very little memory.
|
||||
|
||||
## Setting up restic to use rclone ###
|
||||
|
||||
Now you can [follow the restic
|
||||
@@ -92,7 +96,7 @@ with a path of `/<username>/`.
|
||||
## Server options
|
||||
|
||||
Use --addr to specify which IP address and port the server should
|
||||
listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
listen on, e.g. --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
IPs. By default it only listens on localhost. You can use port
|
||||
:0 to let the OS choose an available port.
|
||||
|
||||
@@ -123,7 +127,7 @@ to be used within the template to server pages:
|
||||
| .Name | The full path of a file/directory. |
|
||||
| .Title | Directory listing of .Name |
|
||||
| .Sort | The current sort used. This is changeable via ?sort= parameter |
|
||||
| | Sort Options: namedirfist,name,size,time (default namedirfirst) |
|
||||
| | Sort Options: namedirfirst,name,size,time (default namedirfirst) |
|
||||
| .Order | The current ordering used. This is changeable via ?order= parameter |
|
||||
| | Order Options: asc,desc (default asc) |
|
||||
| .Query | Currently unused. |
|
||||
@@ -181,6 +185,7 @@ rclone serve restic remote:path [flags]
|
||||
--addr string IPaddress:Port or :Port to bind server to. (default "localhost:8080")
|
||||
--append-only disallow deletion of repository data
|
||||
--baseurl string Prefix for URLs - leave blank for root.
|
||||
--cache-objects cache listed objects (default true)
|
||||
--cert string SSL PEM key (concatenation of certificate and CA certificate)
|
||||
--client-ca string Client certificate authority to verify clients with
|
||||
-h, --help help for restic
|
||||
|
||||
@@ -15,7 +15,7 @@ rclone serve sftp implements an SFTP server to serve the remote
|
||||
over SFTP. This can be used with an SFTP client or you can make a
|
||||
remote of type sftp to use with it.
|
||||
|
||||
You can use the filter flags (eg --include, --exclude) to control what
|
||||
You can use the filter flags (e.g. --include, --exclude) to control what
|
||||
is served.
|
||||
|
||||
The server will log errors. Use -v to see access logs.
|
||||
@@ -139,9 +139,9 @@ second. If rclone is quit or dies with files that haven't been
|
||||
uploaded, these will be uploaded next time rclone is run with the same
|
||||
flags.
|
||||
|
||||
If using --vfs-cache-max-size note that the cache may exceed this size
|
||||
If using `--vfs-cache-max-size` note that the cache may exceed this size
|
||||
for two reasons. Firstly because it is only checked every
|
||||
--vfs-cache-poll-interval. Secondly because open files cannot be
|
||||
`--vfs-cache-poll-interval`. Secondly because open files cannot be
|
||||
evicted from the cache.
|
||||
|
||||
### --vfs-cache-mode off
|
||||
@@ -189,7 +189,7 @@ In this mode all reads and writes are buffered to and from disk. When
|
||||
data is read from the remote this is buffered to disk as well.
|
||||
|
||||
In this mode the files in the cache will be sparse files and rclone
|
||||
will keep track of which bits of the files it has dowloaded.
|
||||
will keep track of which bits of the files it has downloaded.
|
||||
|
||||
So if an application only reads the starts of each file, then rclone
|
||||
will only buffer the start of the file. These files will appear to be
|
||||
@@ -206,6 +206,11 @@ whereas the --vfs-read-ahead is buffered on disk.
|
||||
When using this mode it is recommended that --buffer-size is not set
|
||||
too big and --vfs-read-ahead is set large if required.
|
||||
|
||||
**IMPORTANT** not all file systems support sparse files. In particular
|
||||
FAT/exFAT do not. Rclone will perform very badly if the cache
|
||||
directory is on a filesystem which doesn't support sparse files and it
|
||||
will log an ERROR message if one is detected.
|
||||
|
||||
## VFS Performance
|
||||
|
||||
These flags may be used to enable/disable features of the VFS for
|
||||
@@ -241,6 +246,12 @@ on disk cache file.
|
||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking. (default 20ms)
|
||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error. (default 1s)
|
||||
|
||||
When using VFS write caching (--vfs-cache-mode with value writes or full),
|
||||
the global flag --transfers can be set to adjust the number of parallel uploads of
|
||||
modified files from cache (the related global flag --checkers have no effect on mount).
|
||||
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
|
||||
## VFS Case Sensitivity
|
||||
|
||||
Linux file systems are case-sensitive: two files can differ only
|
||||
@@ -254,7 +265,7 @@ It is not allowed for two files in the same directory to differ only by case.
|
||||
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
||||
file systems case-sensitive but that is not the default
|
||||
|
||||
The "--vfs-case-insensitive" mount flag controls how rclone handles these
|
||||
The `--vfs-case-insensitive` mount flag controls how rclone handles these
|
||||
two cases. If its value is "false", rclone passes file names to the mounted
|
||||
file system as-is. If the flag is "true" (or appears without a value on
|
||||
command line), rclone may perform a "fixup" as explained below.
|
||||
@@ -281,7 +292,7 @@ otherwise. If the flag is provided without a value, then it is "true".
|
||||
If you supply the parameter `--auth-proxy /path/to/program` then
|
||||
rclone will use that program to generate backends on the fly which
|
||||
then are used to authenticate incoming requests. This uses a simple
|
||||
JSON based protocl with input on STDIN and output on STDOUT.
|
||||
JSON based protocol with input on STDIN and output on STDOUT.
|
||||
|
||||
**PLEASE NOTE:** `--auth-proxy` and `--authorized-keys` cannot be used
|
||||
together, if `--auth-proxy` is set the authorized keys option will be
|
||||
@@ -371,7 +382,7 @@ rclone serve sftp remote:path [flags]
|
||||
--dir-cache-time duration Time to cache directory entries for. (default 5m0s)
|
||||
--dir-perms FileMode Directory permissions (default 0777)
|
||||
--file-perms FileMode File permissions (default 0666)
|
||||
--gid uint32 Override the gid field set by the filesystem. (default 1000)
|
||||
--gid uint32 Override the gid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
-h, --help help for sftp
|
||||
--key stringArray SSH private host key file (Can be multi-valued, leave blank to auto generate)
|
||||
--no-auth Allow connections with no authentication if set.
|
||||
@@ -381,8 +392,8 @@ rclone serve sftp remote:path [flags]
|
||||
--pass string Password for authentication.
|
||||
--poll-interval duration Time to wait between polling for changes. Must be smaller than dir-cache-time. Only on supported remotes. Set to 0 to disable. (default 1m0s)
|
||||
--read-only Mount read-only.
|
||||
--uid uint32 Override the uid field set by the filesystem. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. (default 2)
|
||||
--uid uint32 Override the uid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. Not supported on Windows. (default 2)
|
||||
--user string User name for authentication.
|
||||
--vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s)
|
||||
--vfs-cache-max-size SizeSuffix Max total size of objects in the cache. (default off)
|
||||
|
||||
@@ -34,7 +34,7 @@ Use "rclone hashsum" to see the full list.
|
||||
## Server options
|
||||
|
||||
Use --addr to specify which IP address and port the server should
|
||||
listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
listen on, e.g. --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
||||
IPs. By default it only listens on localhost. You can use port
|
||||
:0 to let the OS choose an available port.
|
||||
|
||||
@@ -65,7 +65,7 @@ to be used within the template to server pages:
|
||||
| .Name | The full path of a file/directory. |
|
||||
| .Title | Directory listing of .Name |
|
||||
| .Sort | The current sort used. This is changeable via ?sort= parameter |
|
||||
| | Sort Options: namedirfist,name,size,time (default namedirfirst) |
|
||||
| | Sort Options: namedirfirst,name,size,time (default namedirfirst) |
|
||||
| .Order | The current ordering used. This is changeable via ?order= parameter |
|
||||
| | Order Options: asc,desc (default asc) |
|
||||
| .Query | Currently unused. |
|
||||
@@ -208,9 +208,9 @@ second. If rclone is quit or dies with files that haven't been
|
||||
uploaded, these will be uploaded next time rclone is run with the same
|
||||
flags.
|
||||
|
||||
If using --vfs-cache-max-size note that the cache may exceed this size
|
||||
If using `--vfs-cache-max-size` note that the cache may exceed this size
|
||||
for two reasons. Firstly because it is only checked every
|
||||
--vfs-cache-poll-interval. Secondly because open files cannot be
|
||||
`--vfs-cache-poll-interval`. Secondly because open files cannot be
|
||||
evicted from the cache.
|
||||
|
||||
### --vfs-cache-mode off
|
||||
@@ -258,7 +258,7 @@ In this mode all reads and writes are buffered to and from disk. When
|
||||
data is read from the remote this is buffered to disk as well.
|
||||
|
||||
In this mode the files in the cache will be sparse files and rclone
|
||||
will keep track of which bits of the files it has dowloaded.
|
||||
will keep track of which bits of the files it has downloaded.
|
||||
|
||||
So if an application only reads the starts of each file, then rclone
|
||||
will only buffer the start of the file. These files will appear to be
|
||||
@@ -275,6 +275,11 @@ whereas the --vfs-read-ahead is buffered on disk.
|
||||
When using this mode it is recommended that --buffer-size is not set
|
||||
too big and --vfs-read-ahead is set large if required.
|
||||
|
||||
**IMPORTANT** not all file systems support sparse files. In particular
|
||||
FAT/exFAT do not. Rclone will perform very badly if the cache
|
||||
directory is on a filesystem which doesn't support sparse files and it
|
||||
will log an ERROR message if one is detected.
|
||||
|
||||
## VFS Performance
|
||||
|
||||
These flags may be used to enable/disable features of the VFS for
|
||||
@@ -310,6 +315,12 @@ on disk cache file.
|
||||
--vfs-read-wait duration Time to wait for in-sequence read before seeking. (default 20ms)
|
||||
--vfs-write-wait duration Time to wait for in-sequence write before giving error. (default 1s)
|
||||
|
||||
When using VFS write caching (--vfs-cache-mode with value writes or full),
|
||||
the global flag --transfers can be set to adjust the number of parallel uploads of
|
||||
modified files from cache (the related global flag --checkers have no effect on mount).
|
||||
|
||||
--transfers int Number of file transfers to run in parallel. (default 4)
|
||||
|
||||
## VFS Case Sensitivity
|
||||
|
||||
Linux file systems are case-sensitive: two files can differ only
|
||||
@@ -323,7 +334,7 @@ It is not allowed for two files in the same directory to differ only by case.
|
||||
Usually file systems on macOS are case-insensitive. It is possible to make macOS
|
||||
file systems case-sensitive but that is not the default
|
||||
|
||||
The "--vfs-case-insensitive" mount flag controls how rclone handles these
|
||||
The `--vfs-case-insensitive` mount flag controls how rclone handles these
|
||||
two cases. If its value is "false", rclone passes file names to the mounted
|
||||
file system as-is. If the flag is "true" (or appears without a value on
|
||||
command line), rclone may perform a "fixup" as explained below.
|
||||
@@ -350,7 +361,7 @@ otherwise. If the flag is provided without a value, then it is "true".
|
||||
If you supply the parameter `--auth-proxy /path/to/program` then
|
||||
rclone will use that program to generate backends on the fly which
|
||||
then are used to authenticate incoming requests. This uses a simple
|
||||
JSON based protocl with input on STDIN and output on STDOUT.
|
||||
JSON based protocol with input on STDIN and output on STDOUT.
|
||||
|
||||
**PLEASE NOTE:** `--auth-proxy` and `--authorized-keys` cannot be used
|
||||
together, if `--auth-proxy` is set the authorized keys option will be
|
||||
@@ -444,7 +455,7 @@ rclone serve webdav remote:path [flags]
|
||||
--disable-dir-list Disable HTML directory list on GET request for a directory
|
||||
--etag-hash string Which hash to use for the ETag, or auto or blank for off
|
||||
--file-perms FileMode File permissions (default 0666)
|
||||
--gid uint32 Override the gid field set by the filesystem. (default 1000)
|
||||
--gid uint32 Override the gid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
-h, --help help for webdav
|
||||
--htpasswd string htpasswd file - if not provided no authentication is done
|
||||
--key string SSL PEM Private key
|
||||
@@ -459,8 +470,8 @@ rclone serve webdav remote:path [flags]
|
||||
--server-read-timeout duration Timeout for server reading data (default 1h0m0s)
|
||||
--server-write-timeout duration Timeout for server writing data (default 1h0m0s)
|
||||
--template string User Specified Template.
|
||||
--uid uint32 Override the uid field set by the filesystem. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. (default 2)
|
||||
--uid uint32 Override the uid field set by the filesystem. Not supported on Windows. (default 1000)
|
||||
--umask int Override the permission bits set by the filesystem. Not supported on Windows. (default 2)
|
||||
--user string User name for authentication.
|
||||
--vfs-cache-max-age duration Max age of objects in the cache. (default 1h0m0s)
|
||||
--vfs-cache-max-size SizeSuffix Max total size of objects in the cache. (default off)
|
||||
|
||||
@@ -9,10 +9,6 @@ url: /commands/rclone_size/
|
||||
|
||||
Prints the total size and number of objects in remote:path.
|
||||
|
||||
## Synopsis
|
||||
|
||||
Prints the total size and number of objects in remote:path.
|
||||
|
||||
```
|
||||
rclone size remote:path [flags]
|
||||
```
|
||||
|
||||
@@ -21,9 +21,9 @@ unless the --no-create flag is provided.
|
||||
If --timestamp is used then it will set the modification time to that
|
||||
time instead of the current time. Times may be specified as one of:
|
||||
|
||||
- 'YYMMDD' - eg. 17.10.30
|
||||
- 'YYYY-MM-DDTHH:MM:SS' - eg. 2006-01-02T15:04:05
|
||||
- 'YYYY-MM-DDTHH:MM:SS.SSS' - eg. 2006-01-02T15:04:05.123456789
|
||||
- 'YYMMDD' - e.g. 17.10.30
|
||||
- 'YYYY-MM-DDTHH:MM:SS' - e.g. 2006-01-02T15:04:05
|
||||
- 'YYYY-MM-DDTHH:MM:SS.SSS' - e.g. 2006-01-02T15:04:05.123456789
|
||||
|
||||
Note that --timestamp is in UTC if you want local time then add the
|
||||
--localtime flag.
|
||||
|
||||
@@ -28,7 +28,7 @@ For example
|
||||
|
||||
1 directories, 5 files
|
||||
|
||||
You can use any of the filtering options with the tree command (eg
|
||||
You can use any of the filtering options with the tree command (e.g.
|
||||
--include and --exclude). You can also use --fast-list.
|
||||
|
||||
The tree command has many options for controlling the listing which
|
||||
|
||||
@@ -6,11 +6,14 @@ description: "Compression Remote"
|
||||
{{< icon "fas fa-compress" >}}Compress (Experimental)
|
||||
-----------------------------------------
|
||||
|
||||
### Warning
|
||||
This remote is currently **experimental**. Things may break and data may be lost. Anything you do with this remote is
|
||||
at your own risk. Please understand the risks associated with using experimental code and don't use this remote in
|
||||
critical applications.
|
||||
|
||||
The `Compress` remote adds compression to another remote. It is best used with remotes containing
|
||||
many large compressible files.
|
||||
|
||||
Please read the [warnings](#warnings) before using this remote.
|
||||
|
||||
To use this remote, all you need to do is specify another remote and a compression mode to use:
|
||||
|
||||
```
|
||||
@@ -80,11 +83,6 @@ correct metadata files will not be recognized by rclone.
|
||||
The compressed files will be named `*.###########.gz` where `*` is the base file and the `#` part is base64 encoded
|
||||
size of the uncompressed file. The file names should not be changed by anything other than the rclone compression backend.
|
||||
|
||||
#### Experimental
|
||||
This remote is currently **experimental**. Things may break and data may be lost. Anything you do with this remote is
|
||||
at your own risk. Please understand the risks associated with using experimental code and don't use this remote in
|
||||
critical applications.
|
||||
|
||||
{{< rem autogenerated options start" - DO NOT EDIT - instead edit fs.RegInfo in backend/compress/compress.go then run make backenddocs" >}}
|
||||
### Standard Options
|
||||
|
||||
@@ -132,4 +130,18 @@ GZIP compression level (-2 to 9).
|
||||
- Type: int
|
||||
- Default: -1
|
||||
|
||||
#### --compress-ram-cache-limit
|
||||
|
||||
Some remotes don't allow the upload of files with unknown size.
|
||||
In this case the compressed file will need to be cached to determine
|
||||
it's size.
|
||||
|
||||
Files smaller than this limit will be cached in RAM, file larger than
|
||||
this limit will be cached on disk
|
||||
|
||||
- Config: ram_cache_limit
|
||||
- Env Var: RCLONE_COMPRESS_RAM_CACHE_LIMIT
|
||||
- Type: SizeSuffix
|
||||
- Default: 20M
|
||||
|
||||
{{< rem autogenerated options stop >}}
|
||||
+187
-49
@@ -8,59 +8,126 @@ description: "Encryption overlay remote"
|
||||
|
||||
Rclone `crypt` remotes encrypt and decrypt other remotes.
|
||||
|
||||
To use `crypt`, first set up the underlying remote. Follow the `rclone
|
||||
config` instructions for that remote.
|
||||
A remote of type `crypt` does not access a [storage system](https://rclone.org/overview/)
|
||||
directly, but instead wraps another remote, which in turn accesses
|
||||
the storage system. This is similar to how [alias](https://rclone.org/alias/),
|
||||
[union](https://rclone.org/union/), [chunker](https://rclone.org/chunker/)
|
||||
and a few others work. It makes the usage very flexible, as you can
|
||||
add a layer, in this case an encryption layer, on top of any other
|
||||
backend, even in multiple layers. Rclone's functionality
|
||||
can be used as with any other remote, for example you can
|
||||
[mount](https://rclone.org/commands/rclone_mount/) a crypt remote.
|
||||
|
||||
`crypt` applied to a local pathname instead of a remote will
|
||||
encrypt and decrypt that directory, and can be used to encrypt USB
|
||||
removable drives.
|
||||
Accessing a storage system through a crypt remote realizes client-side
|
||||
encryption, which makes it safe to keep your data in a location you do
|
||||
not trust will not get compromised.
|
||||
When working against the `crypt` remote, rclone will automatically
|
||||
encrypt (before uploading) and decrypt (after downloading) on your local
|
||||
system as needed on the fly, leaving the data encrypted at rest in the
|
||||
wrapped remote. If you access the storage system using an application
|
||||
other than rclone, or access the wrapped remote directly using rclone,
|
||||
there will not be any encryption/decryption: Downloading existing content
|
||||
will just give you the encrypted (scrambled) format, and anything you
|
||||
upload will *not* become encrypted.
|
||||
|
||||
The encryption is a secret-key encryption (also called symmetric key encryption)
|
||||
algorithm, where a password (or pass phrase) is used to generate real encryption key.
|
||||
The password can be supplied by user, or you may chose to let rclone
|
||||
generate one. It will be stored in the configuration file, in a lightly obscured form.
|
||||
If you are in an environment where you are not able to keep your configuration
|
||||
secured, you should add
|
||||
[configuration encryption](https://rclone.org/docs/#configuration-encryption)
|
||||
as protection. As long as you have this configuration file, you will be able to
|
||||
decrypt your data. Without the configuration file, as long as you remember
|
||||
the password (or keep it in a safe place), you can re-create the configuration
|
||||
and gain access to the existing data. You may also configure a corresponding
|
||||
remote in a different installation to access the same data.
|
||||
See below for guidance to [changing password](#changing-password).
|
||||
|
||||
Encryption uses [cryptographic salt](https://en.wikipedia.org/wiki/Salt_(cryptography)),
|
||||
to permute the encryption key so that the same string may be encrypted in
|
||||
different ways. When configuring the crypt remote it is optional to enter a salt,
|
||||
or to let rclone generate a unique salt. If omitted, rclone uses a built-in unique string.
|
||||
Normally in cryptography, the salt is stored together with the encrypted content,
|
||||
and do not have to be memorized by the user. This is not the case in rclone,
|
||||
because rclone does not store any additional information on the remotes. Use of
|
||||
custom salt is effectively a second password that must be memorized.
|
||||
|
||||
[File content](#file-encryption) encryption is performed using
|
||||
[NaCl SecretBox](https://godoc.org/golang.org/x/crypto/nacl/secretbox),
|
||||
based on XSalsa20 cipher and Poly1305 for integrity.
|
||||
[Names](#name-encryption) (file- and directory names) are also encrypted
|
||||
by default, but this has some implications and is therefore
|
||||
possible to turned off.
|
||||
|
||||
### Configuration
|
||||
|
||||
Here is an example of how to make a remote called `secret`.
|
||||
|
||||
To use `crypt`, first set up the underlying remote. Follow the
|
||||
`rclone config` instructions for the specific backend.
|
||||
|
||||
Before configuring the crypt remote, check the underlying remote is
|
||||
working. In this example the underlying remote is called `remote:path`.
|
||||
Anything inside `remote:path` will be encrypted and anything outside
|
||||
will not. In the case of an S3 based underlying remote (e.g. Amazon S3,
|
||||
B2, Swift) it is generally advisable to define a crypt remote in the
|
||||
underlying remote `s3:bucket`. If `s3:` alone is specified alongside
|
||||
file name encryption, rclone will encrypt the bucket name.
|
||||
working. In this example the underlying remote is called `remote`.
|
||||
We will configure a path `path` within this remote to contain the
|
||||
encrypted content. Anything inside `remote:path` will be encrypted
|
||||
and anything outside will not.
|
||||
|
||||
Configure `crypt` using `rclone config`. In this example the `crypt`
|
||||
remote is called `secret`, to differentiate it from the underlying
|
||||
`remote`.
|
||||
|
||||
When you are done you can use the crypt remote named `secret` just
|
||||
as you would with any other remote, e.g. `rclone copy D:\docs secret:\docs`,
|
||||
and rclone will encrypt and decrypt as needed on the fly.
|
||||
If you access the wrapped remote `remote:path` directly you will bypass
|
||||
the encryption, and anything you read will be in encrypted form, and
|
||||
anything you write will be undencrypted. To avoid issues it is best to
|
||||
configure a dedicated path for encrypted content, and access it
|
||||
exclusively through a crypt remote.
|
||||
|
||||
```
|
||||
No remotes found - make a new one
|
||||
n) New remote
|
||||
s) Set configuration password
|
||||
q) Quit config
|
||||
n/s/q> n
|
||||
n/s/q> n
|
||||
name> secret
|
||||
Type of storage to configure.
|
||||
Enter a string value. Press Enter for the default ("").
|
||||
Choose a number from below, or type in your own value
|
||||
[snip]
|
||||
XX / Encrypt/Decrypt a remote
|
||||
\ "crypt"
|
||||
[snip]
|
||||
Storage> crypt
|
||||
** See help for crypt backend at: https://rclone.org/crypt/ **
|
||||
|
||||
Remote to encrypt/decrypt.
|
||||
Normally should contain a ':' and a path, e.g. "myremote:path/to/dir",
|
||||
Normally should contain a ':' and a path, eg "myremote:path/to/dir",
|
||||
"myremote:bucket" or maybe "myremote:" (not recommended).
|
||||
Enter a string value. Press Enter for the default ("").
|
||||
remote> remote:path
|
||||
How to encrypt the filenames.
|
||||
Enter a string value. Press Enter for the default ("standard").
|
||||
Choose a number from below, or type in your own value
|
||||
1 / Don't encrypt the file names. Adds a ".bin" extension only.
|
||||
\ "off"
|
||||
2 / Encrypt the filenames see the docs for the details.
|
||||
1 / Encrypt the filenames see the docs for the details.
|
||||
\ "standard"
|
||||
3 / Very simple filename obfuscation.
|
||||
2 / Very simple filename obfuscation.
|
||||
\ "obfuscate"
|
||||
filename_encryption> 2
|
||||
3 / Don't encrypt the file names. Adds a ".bin" extension only.
|
||||
\ "off"
|
||||
filename_encryption>
|
||||
Option to either encrypt directory names or leave them intact.
|
||||
|
||||
NB If filename_encryption is "off" then this option will do nothing.
|
||||
Enter a boolean value (true or false). Press Enter for the default ("true").
|
||||
Choose a number from below, or type in your own value
|
||||
1 / Encrypt directory names.
|
||||
\ "true"
|
||||
2 / Don't encrypt directory names, leave them intact.
|
||||
\ "false"
|
||||
directory_name_encryption> 1
|
||||
directory_name_encryption>
|
||||
Password or pass phrase for encryption.
|
||||
y) Yes type in my own password
|
||||
g) Generate random password
|
||||
@@ -73,7 +140,7 @@ Password or pass phrase for salt. Optional but recommended.
|
||||
Should be different to the previous password.
|
||||
y) Yes type in my own password
|
||||
g) Generate random password
|
||||
n) No leave this optional password blank
|
||||
n) No leave this optional password blank (default)
|
||||
y/g/n> g
|
||||
Password strength in bits.
|
||||
64 is just about memorable
|
||||
@@ -81,27 +148,33 @@ Password strength in bits.
|
||||
1024 is the maximum
|
||||
Bits> 128
|
||||
Your password is: JAsJvRcgR-_veXNfy_sGmQ
|
||||
Use this password?
|
||||
y) Yes
|
||||
Use this password? Please note that an obscured version of this
|
||||
password (and not the password itself) will be stored under your
|
||||
configuration file, so keep this generated password in a safe place.
|
||||
y) Yes (default)
|
||||
n) No
|
||||
y/n> y
|
||||
y/n>
|
||||
Edit advanced config? (y/n)
|
||||
y) Yes
|
||||
n) No (default)
|
||||
y/n>
|
||||
Remote config
|
||||
--------------------
|
||||
[secret]
|
||||
type = crypt
|
||||
remote = remote:path
|
||||
filename_encryption = standard
|
||||
password = *** ENCRYPTED ***
|
||||
password2 = *** ENCRYPTED ***
|
||||
--------------------
|
||||
y) Yes this is OK
|
||||
y) Yes this is OK (default)
|
||||
e) Edit this remote
|
||||
d) Delete this remote
|
||||
y/e/d> y
|
||||
y/e/d>
|
||||
```
|
||||
|
||||
**Important** The crypt password stored in `rclone.conf` is lightly
|
||||
obscured. That only protects it from cursory inspection. It is not
|
||||
secure unless encryption of `rclone.conf` is specified.
|
||||
secure unless [configuration encryption](https://rclone.org/docs/#configuration-encryption) of `rclone.conf` is specified.
|
||||
|
||||
A long passphrase is recommended, or `rclone config` can generate a
|
||||
random one.
|
||||
@@ -119,20 +192,80 @@ Rclone does not encrypt
|
||||
* file length - this can be calculated within 16 bytes
|
||||
* modification time - used for syncing
|
||||
|
||||
## Specifying the remote ##
|
||||
### Specifying the remote
|
||||
|
||||
In normal use, ensure the remote has a `:` in. If specified without,
|
||||
rclone uses a local directory of that name. For example if a remote
|
||||
`/path/to/secret/files` is specified, rclone encrypts content to that
|
||||
directory. If a remote `name` is specified, rclone targets a directory
|
||||
`name` in the current directory.
|
||||
When configuring the remote to encrypt/decrypt, you may specify any
|
||||
string that rclone accepts as a source/destination of other commands.
|
||||
|
||||
If remote `remote:path/to/dir` is specified, rclone stores encrypted
|
||||
The primary use case is to specify the path into an already configured
|
||||
remote (e.g. `remote:path/to/dir` or `remote:bucket`), such that
|
||||
data in a remote untrusted location can be stored encrypted.
|
||||
|
||||
You may also specify a local filesystem path, such as
|
||||
`/path/to/dir` on Linux, `C:\path\to\dir` on Windows. By creating
|
||||
a crypt remote pointing to such a local filesystem path, you can
|
||||
use rclone as a utility for pure local file encryption, for example
|
||||
to keep encrypted files on a removable USB drive.
|
||||
|
||||
**Note**: A string which do not contain a `:` will by rclone be treated
|
||||
as a relative path in the local filesystem. For example, if you enter
|
||||
the name `remote` without the trailing `:`, it will be treated as
|
||||
a subdirectory of the current directory with name "remote".
|
||||
|
||||
If a path `remote:path/to/dir` is specified, rclone stores encrypted
|
||||
files in `path/to/dir` on the remote. With file name encryption, files
|
||||
saved to `secret:subdir/subfile` are stored in the unencrypted path
|
||||
`path/to/dir` but the `subdir/subpath` element is encrypted.
|
||||
|
||||
## Example ##
|
||||
The path you specify does not have to exist, rclone will create
|
||||
it when needed.
|
||||
|
||||
If you intend to use the wrapped remote both directly for keeping
|
||||
unencrypted content, as well as through a crypt remote for encrypted
|
||||
content, it is recommended to point the crypt remote to a separate
|
||||
directory within the wrapped remote. If you use a bucket based storage
|
||||
system (e.g. Swift, S3, Google Compute Storage, B2, Hubic) it is generally
|
||||
advisable to wrap the crypt remote around a specific bucket (`s3:bucket`).
|
||||
If wrapping around the entire root of the storage (`s3:`), and use the
|
||||
optional file name encryption, rclone will encrypt the bucket name.
|
||||
|
||||
### Changing password
|
||||
|
||||
Should the password, or the configuration file containing a lightly obscured
|
||||
form of the password, be compromised, you need to re-encrypt your data with
|
||||
a new password. Since rclone uses secret-key encryption, where the encryption
|
||||
key is generated directly from the password kept on the client, it is not
|
||||
possible to change the password/key of already encrypted content. Just changing
|
||||
the password configured for an existing crypt remote means you will no longer
|
||||
able to decrypt any of the previously encrypted content. The only possibility
|
||||
is to re-upload everything via a crypt remote configured with your new password.
|
||||
|
||||
Depending on the size of your data, your bandwith, storage quota etc, there are
|
||||
different approaches you can take:
|
||||
- If you have everything in a different location, for example on your local system,
|
||||
you could remove all of the prior encrypted files, change the password for your
|
||||
configured crypt remote (or delete and re-create the crypt configuration),
|
||||
and then re-upload everything from the alternative location.
|
||||
- If you have enough space on the storage system you can create a new crypt
|
||||
remote pointing to a separate directory on the same backend, and then use
|
||||
rclone to copy everything from the original crypt remote to the new,
|
||||
effectively decrypting everything on the fly using the old password and
|
||||
re-encrypting using the new password. When done, delete the original crypt
|
||||
remote directory and finally the rclone crypt configuration with the old password.
|
||||
All data will be streamed from the storage system and back, so you will
|
||||
get half the bandwith and be charged twice if you have upload and download quota
|
||||
on the storage system.
|
||||
|
||||
**Note**: A security problem related to the random password generator
|
||||
was fixed in rclone version 1.53.3 (released 2020-11-19). Passwords generated
|
||||
by rclone config in version 1.49.0 (released 2019-08-26) to 1.53.2
|
||||
(released 2020-10-26) are not considered secure and should be changed.
|
||||
If you made up your own password, or used rclone version older than 1.49.0 or
|
||||
newer than 1.53.2 to generate it, you are *not* affected by this issue.
|
||||
See [issue #4783](https://github.com/rclone/rclone/issues/4783) for more
|
||||
details, and a tool you can use to check if you are affected.
|
||||
|
||||
### Example
|
||||
|
||||
Create the following file structure using "standard" file name
|
||||
encryption.
|
||||
@@ -193,7 +326,7 @@ $ rclone -q ls remote:path
|
||||
55 file1.txt.bin
|
||||
```
|
||||
|
||||
### File name encryption modes ###
|
||||
### File name encryption modes
|
||||
|
||||
Off
|
||||
|
||||
@@ -223,7 +356,7 @@ segment names.
|
||||
|
||||
There is a possibility with some unicode based filenames that the
|
||||
obfuscation is weak and may map lower case characters to upper case
|
||||
equivalents.
|
||||
equivalents.
|
||||
|
||||
Obfuscation cannot be relied upon for strong protection.
|
||||
|
||||
@@ -242,7 +375,8 @@ cloud storage provider.
|
||||
An alternative, future rclone file name encryption mode may tolerate
|
||||
backend provider path length limits.
|
||||
|
||||
### Directory name encryption ###
|
||||
### Directory name encryption
|
||||
|
||||
Crypt offers the option of encrypting dir names or leaving them intact.
|
||||
There are two options:
|
||||
|
||||
@@ -261,7 +395,7 @@ Example:
|
||||
`1/12/qgm4avr35m5loi1th53ato71v0`
|
||||
|
||||
|
||||
### Modified time and hashes ###
|
||||
### Modified time and hashes
|
||||
|
||||
Crypt stores modification times using the underlying remote so support
|
||||
depends on that.
|
||||
@@ -432,7 +566,7 @@ Usage Example:
|
||||
|
||||
{{< rem autogenerated options stop >}}
|
||||
|
||||
## Backing up a crypted remote ##
|
||||
## Backing up a crypted remote
|
||||
|
||||
If you wish to backup a crypted remote, it is recommended that you use
|
||||
`rclone sync` on the encrypted files, and make sure the passwords are
|
||||
@@ -458,14 +592,14 @@ And to check the integrity you would do
|
||||
|
||||
rclone check remote:crypt remote2:crypt
|
||||
|
||||
## File formats ##
|
||||
## File formats
|
||||
|
||||
### File encryption ###
|
||||
### File encryption
|
||||
|
||||
Files are encrypted 1:1 source file to destination object. The file
|
||||
has a header and is divided into chunks.
|
||||
|
||||
#### Header ####
|
||||
#### Header
|
||||
|
||||
* 8 bytes magic string `RCLONE\x00\x00`
|
||||
* 24 bytes Nonce (IV)
|
||||
@@ -477,11 +611,11 @@ The chance of a nonce being re-used is minuscule. If you wrote an
|
||||
exabyte of data (10¹⁸ bytes) you would have a probability of
|
||||
approximately 2×10⁻³² of re-using a nonce.
|
||||
|
||||
#### Chunk ####
|
||||
#### Chunk
|
||||
|
||||
Each chunk will contain 64kB of data, except for the last one which
|
||||
may have less data. The data chunk is in standard NACL secretbox
|
||||
format. Secretbox uses XSalsa20 and Poly1305 to encrypt and
|
||||
may have less data. The data chunk is in standard NaCl SecretBox
|
||||
format. SecretBox uses XSalsa20 and Poly1305 to encrypt and
|
||||
authenticate messages.
|
||||
|
||||
Each chunk contains:
|
||||
@@ -496,7 +630,7 @@ buffered in memory so they can't be too big.
|
||||
|
||||
This uses a 32 byte (256 bit key) key derived from the user password.
|
||||
|
||||
#### Examples ####
|
||||
#### Examples
|
||||
|
||||
1 byte file will encrypt to
|
||||
|
||||
@@ -513,7 +647,7 @@ This uses a 32 byte (256 bit key) key derived from the user password.
|
||||
1049120 bytes total (a 0.05% overhead). This is the overhead for big
|
||||
files.
|
||||
|
||||
### Name encryption ###
|
||||
### Name encryption
|
||||
|
||||
File names are encrypted segment by segment - the path is broken up
|
||||
into `/` separated strings and these are encrypted individually.
|
||||
@@ -547,7 +681,7 @@ encoding is modified in two ways:
|
||||
`base32` is used rather than the more efficient `base64` so rclone can be
|
||||
used on case insensitive remotes (e.g. Windows, Amazon Drive).
|
||||
|
||||
### Key derivation ###
|
||||
### Key derivation
|
||||
|
||||
Rclone uses `scrypt` with parameters `N=16384, r=8, p=1` with an
|
||||
optional user supplied salt (password2) to derive the 32+32+16 = 80
|
||||
@@ -557,3 +691,7 @@ then rclone uses an internal one.
|
||||
`scrypt` makes it impractical to mount a dictionary attack on rclone
|
||||
encrypted data. For full protection against this you should always use
|
||||
a salt.
|
||||
|
||||
## SEE ALSO
|
||||
|
||||
* [rclone cryptdecode](/commands/rclone_cryptdecode/) - Show forward/reverse mapping of encrypted filenames
|
||||
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user