3699: fix namespace clash: rename module to arv_copy
[arvados.git] / sdk / python / bin / arv-ls
1 #!/usr/bin/env python
2
3 import argparse
4
5 import arvados
6 import arvados.commands._util as arv_cmd
7
8 parser = argparse.ArgumentParser(
9     description='List contents of a manifest',
10     parents=[arv_cmd.retry_opt])
11
12 parser.add_argument('locator', type=str,
13                     help="Collection UUID or locator")
14 parser.add_argument('-s', action='store_true', help="""List file sizes, in KiB.""")
15
16 args = parser.parse_args()
17 cr = arvados.CollectionReader(args.locator, num_retries=args.retries)
18
19 for f in cr.all_files():
20     if args.s:
21         print "{:>10} {}".format((f.size() + 1023) / 1024,
22                                  f.stream_name() + "/" + f.name())
23     else:
24         print f.stream_name() + "/" + f.name()