mirror of
https://github.com/rclone/rclone.git
synced 2024-11-29 03:48:27 +08:00
Use filesystem walk ordering rather than hash order
This commit is contained in:
parent
3e4f75b558
commit
a49b8ca0b6
|
@ -13,8 +13,6 @@ subargs.append('x-object-meta-mtime:%d' % getmtime(options.input_))
|
||||||
Need an iterate all objects routine... Could use a channel
|
Need an iterate all objects routine... Could use a channel
|
||||||
- could just be a flag to Objects()
|
- could just be a flag to Objects()
|
||||||
|
|
||||||
FIXME ordering not hash order
|
|
||||||
|
|
||||||
FIXME progress meter would be nice! Do this by wrapping the Reader with a progress bar
|
FIXME progress meter would be nice! Do this by wrapping the Reader with a progress bar
|
||||||
|
|
||||||
Do bandwidth limit by wrapping the Reader too
|
Do bandwidth limit by wrapping the Reader too
|
||||||
|
|
|
@ -40,7 +40,7 @@ type FsObject struct {
|
||||||
info os.FileInfo
|
info os.FileInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type FsObjects map[string]FsObject
|
type FsObjects []FsObject
|
||||||
|
|
||||||
// md5sum calculates the md5sum of a file returning a lowercase hex string
|
// md5sum calculates the md5sum of a file returning a lowercase hex string
|
||||||
func md5sum(path string) (string, error) {
|
func md5sum(path string) (string, error) {
|
||||||
|
@ -141,7 +141,7 @@ func (fs *FsObject) put(c *swift.Connection, container string) {
|
||||||
// FIXME ignore symlinks?
|
// FIXME ignore symlinks?
|
||||||
// FIXME what about hardlinks / etc
|
// FIXME what about hardlinks / etc
|
||||||
func walk(root string) FsObjects {
|
func walk(root string) FsObjects {
|
||||||
files := make(FsObjects)
|
files := make(FsObjects, 0, 1024)
|
||||||
err := filepath.Walk(root, func(path string, f os.FileInfo, err error) error {
|
err := filepath.Walk(root, func(path string, f os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to open directory: %s: %s", path, err)
|
log.Printf("Failed to open directory: %s: %s", path, err)
|
||||||
|
@ -159,7 +159,7 @@ func walk(root string) FsObjects {
|
||||||
if rel == "." {
|
if rel == "." {
|
||||||
rel = ""
|
rel = ""
|
||||||
}
|
}
|
||||||
files[rel] = FsObject{rel: rel, path: path, info: info}
|
files = append(files, FsObject{rel: rel, path: path, info: info})
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue
Block a user