MCPcopy
hub / github.com/rclone/rclone / listSubdirs

Method listSubdirs

cmd/bisync/bisync_test.go:1312–1332  ·  view source on GitHub ↗

listSubdirs is equivalent to `rclone lsf -R [--dirs-only]`

(ctx context.Context, remote string, DirsOnly bool)

Source from the content-addressed store, hash-verified

1310
1311// listSubdirs is equivalent to `rclone lsf -R [--dirs-only]`
1312func (b *bisyncTest) listSubdirs(ctx context.Context, remote string, DirsOnly bool) error {
1313 f, err := cache.Get(ctx, remote)
1314 if err != nil {
1315 return err
1316 }
1317
1318 opt := operations.ListJSONOpt{
1319 NoModTime: true,
1320 NoMimeType: true,
1321 DirsOnly: DirsOnly,
1322 Recurse: true,
1323 }
1324 fmt := operations.ListFormat{}
1325 fmt.SetDirSlash(true)
1326 fmt.AddPath()
1327 printItem := func(item *operations.ListJSONItem) error {
1328 b.logPrintf("%s - filename hash: %s", fmt.Format(item), stringToHash(item.Name))
1329 return nil
1330 }
1331 return operations.ListJSON(ctx, f, "", &opt, printItem)
1332}
1333
1334// purgeChildren deletes child files and purges subdirs under given path.
1335// Note: this cannot be done with filters.

Callers 1

runTestStepMethod · 0.95

Calls 7

SetDirSlashMethod · 0.95
AddPathMethod · 0.95
logPrintfMethod · 0.95
FormatMethod · 0.95
GetFunction · 0.92
ListJSONFunction · 0.92
stringToHashFunction · 0.85

Tested by

no test coverage detected