Export to csv
opensourcestough opened this issue · 10 comments
Would you please add the ability to export to csv.
Sure, let me look into it and I'll get back to you with something.
The version in the csv branch provides a new command export
which will print the entire tree in csv (comma separated, with quoted fields) with the following content
name,type,path,size,md5
Can you give it a try and let me know if that matches your expectations?
Thank you for the quick answer. It is close, would you be able to add md5 of the directory and the date? I am looking for the like the output of this export http://vvvapp.sourceforge.net/, just with added md5s.
I updated the format which now looks like this:
name,type,path,size,indexed_at,maccess,md5
The fields are described in the README in the csv branch.
- indexed_at: when this entry was indexed
- maccess: the file modification date/time
I'm however not sure what you mean by md5 of the directory
? Currently catcli doesn't calculate md5 sum of directories, only files.
That is great, would it be able to add them as switches to the other items (e.g. ls and find). Yes, only if it is easily done. I do get an error when I output to the filename directly without redirecting stdout.
I have added --format
to ls
and find
which, when set to --format=csv
, will output the results in CSV.
Note that the export
command is equivalent to tree
when using --format=native
(which is the default now).
This hasn't been extensively tested though. I hope it matches what you need.
Well I actually cleaned a bit and removed the export
command but added --format
to the tree
command.
Now you can print results in csv
for the following commands: ls
, find
, tree
.
The csv header is never added but can be found in the README as well as when running the print_supported_formats
command:
$ catcli print_supported_formats
"native": native format
"csv" : CSV format
name,type,path,size,indexed_at,maccess,md5
I feel you need the header switch. Ideally the export command remains , and you just add a switches for csv and header to the rest
tree
now supports a switch -H --header
to print the CSV header.
These changes will be merged in next version. Thanks for your inputs!
A new version of catcli v0.8.0
has been released and contains all the updates to handle CSV outputs.