ListR lists the objects and directories of the Fs starting from dir recursively into out.
(ctx context.Context, dir string, callback fs.ListRCallback)
| 1115 | // ListR lists the objects and directories of the Fs starting |
| 1116 | // from dir recursively into out. |
| 1117 | func (f *Fs) ListR(ctx context.Context, dir string, callback fs.ListRCallback) (err error) { |
| 1118 | fs.Debugf(f, "list recursively from '%s'", dir) |
| 1119 | |
| 1120 | // we check if the source FS supports ListR |
| 1121 | // if it does, we'll use that to get all the entries, cache them and return |
| 1122 | do := f.Fs.Features().ListR |
| 1123 | if do != nil { |
| 1124 | return do(ctx, dir, func(entries fs.DirEntries) error { |
| 1125 | // we got called back with a set of entries so let's cache them and call the original callback |
| 1126 | for _, entry := range entries { |
| 1127 | switch o := entry.(type) { |
| 1128 | case fs.Object: |
| 1129 | _ = f.cache.AddObject(ObjectFromOriginal(ctx, f, o)) |
| 1130 | case fs.Directory: |
| 1131 | _ = f.cache.AddDir(DirectoryFromOriginal(ctx, f, o)) |
| 1132 | default: |
| 1133 | return fmt.Errorf("unknown object type %T", entry) |
| 1134 | } |
| 1135 | } |
| 1136 | |
| 1137 | // call the original callback |
| 1138 | return callback(entries) |
| 1139 | }) |
| 1140 | } |
| 1141 | |
| 1142 | // if we're here, we're gonna do a standard recursive traversal and cache everything |
| 1143 | list := list.NewHelper(callback) |
| 1144 | err = f.recurse(ctx, dir, list) |
| 1145 | if err != nil { |
| 1146 | return err |
| 1147 | } |
| 1148 | |
| 1149 | return list.Flush() |
| 1150 | } |
| 1151 | |
| 1152 | // Mkdir makes the directory (container, bucket) |
| 1153 | func (f *Fs) Mkdir(ctx context.Context, dir string) error { |
nothing calls this directly
no test coverage detected