forked from TrueCloudLab/rclone
quatrix: add option to skip project folders
This commit is contained in:
parent
43823bc925
commit
11c6489fd1
3 changed files with 49 additions and 2 deletions
|
@ -104,6 +104,16 @@ func (f *File) IsDir() bool {
|
||||||
return f.Type == "D" || f.Type == "S" || f.Type == "T"
|
return f.Type == "D" || f.Type == "S" || f.Type == "T"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsProjectFolder returns true if object is a project folder
|
||||||
|
// false otherwise
|
||||||
|
func (f *File) IsProjectFolder() bool {
|
||||||
|
if f == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return f.Type == "S"
|
||||||
|
}
|
||||||
|
|
||||||
// SetMTimeParams is the request to set modification time for object
|
// SetMTimeParams is the request to set modification time for object
|
||||||
type SetMTimeParams struct {
|
type SetMTimeParams struct {
|
||||||
ID string `json:"id,omitempty"`
|
ID string `json:"id,omitempty"`
|
||||||
|
|
|
@ -89,7 +89,13 @@ func init() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "hard_delete",
|
Name: "hard_delete",
|
||||||
Help: "Delete files permanently rather than putting them into the trash.",
|
Help: "Delete files permanently rather than putting them into the trash",
|
||||||
|
Advanced: true,
|
||||||
|
Default: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "skip_project_folders",
|
||||||
|
Help: "Skip project folders in operations",
|
||||||
Advanced: true,
|
Advanced: true,
|
||||||
Default: false,
|
Default: false,
|
||||||
},
|
},
|
||||||
|
@ -106,6 +112,7 @@ type Options struct {
|
||||||
MinimalChunkSize fs.SizeSuffix `config:"minimal_chunk_size"`
|
MinimalChunkSize fs.SizeSuffix `config:"minimal_chunk_size"`
|
||||||
MaximalSummaryChunkSize fs.SizeSuffix `config:"maximal_summary_chunk_size"`
|
MaximalSummaryChunkSize fs.SizeSuffix `config:"maximal_summary_chunk_size"`
|
||||||
HardDelete bool `config:"hard_delete"`
|
HardDelete bool `config:"hard_delete"`
|
||||||
|
SkipProjectFolders bool `config:"skip_project_folders"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fs represents remote Quatrix fs
|
// Fs represents remote Quatrix fs
|
||||||
|
@ -376,6 +383,10 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range folder.Content {
|
for _, file := range folder.Content {
|
||||||
|
if f.skipFile(&file) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
remote := path.Join(dir, f.opt.Enc.ToStandardName(file.Name))
|
remote := path.Join(dir, f.opt.Enc.ToStandardName(file.Name))
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
f.dirCache.Put(remote, file.ID)
|
f.dirCache.Put(remote, file.ID)
|
||||||
|
@ -401,6 +412,10 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
|
||||||
return entries, nil
|
return entries, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *Fs) skipFile(file *api.File) bool {
|
||||||
|
return f.opt.SkipProjectFolders && file.IsProjectFolder()
|
||||||
|
}
|
||||||
|
|
||||||
// NewObject finds the Object at remote. If it can't be found
|
// NewObject finds the Object at remote. If it can't be found
|
||||||
// it returns the error fs.ErrorObjectNotFound.
|
// it returns the error fs.ErrorObjectNotFound.
|
||||||
func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
|
func (f *Fs) NewObject(ctx context.Context, remote string) (fs.Object, error) {
|
||||||
|
|
|
@ -227,7 +227,7 @@ Properties:
|
||||||
|
|
||||||
#### --quatrix-hard-delete
|
#### --quatrix-hard-delete
|
||||||
|
|
||||||
Delete files permanently rather than putting them into the trash.
|
Delete files permanently rather than putting them into the trash
|
||||||
|
|
||||||
Properties:
|
Properties:
|
||||||
|
|
||||||
|
@ -236,6 +236,28 @@ Properties:
|
||||||
- Type: bool
|
- Type: bool
|
||||||
- Default: false
|
- Default: false
|
||||||
|
|
||||||
|
#### --quatrix-skip-project-folders
|
||||||
|
|
||||||
|
Skip project folders in operations
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
|
||||||
|
- Config: skip_project_folders
|
||||||
|
- Env Var: RCLONE_QUATRIX_SKIP_PROJECT_FOLDERS
|
||||||
|
- Type: bool
|
||||||
|
- Default: false
|
||||||
|
|
||||||
|
#### --quatrix-description
|
||||||
|
|
||||||
|
Description of the remote
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
|
||||||
|
- Config: description
|
||||||
|
- Env Var: RCLONE_QUATRIX_DESCRIPTION
|
||||||
|
- Type: string
|
||||||
|
- Required: false
|
||||||
|
|
||||||
{{< rem autogenerated options stop >}}
|
{{< rem autogenerated options stop >}}
|
||||||
|
|
||||||
## Storage usage
|
## Storage usage
|
||||||
|
|
Loading…
Reference in a new issue