Obtaining a list of files and directories (also empty ones) for a path

With lsl I can get a (recursive) list of files, but empty directories are not reported.
With lsd I can get a (non-recursive) list of directories (also empty ones), but not the files.
Any option I missed to get a recursive list of both files and directories (empty ones included)?

You can use the undocumented, subject to change rclone ls2 command with the -R flag.

I reserve the right to remove, rename and re-invent this command, but it should do what you want!

You could also use lsjson if you want JSON output.

lsjson -R! Just what I was looking for.
OK, now I’m using it and you lost your right to remove, rename and re-invent this command.
Seriously, I’m trying to implement two-ways file sync on top on rclone and you might want to create empty directories when restoring to a new peer.

Rats! lsjson gets creative with datetime formats…
This is from local filesystem:
and this is from google drive:
how many different formats should I expect?

lsjson is here to stay - don’t worry!


Those are both the same format, RFC3339 format with Nanosecond precision…

You’ve got to tell that to python.
For whichever reason (just to try another language, I guess) I decided to use python and I discovered that its management of date/time parsing is less than optimal and -lsjson is too creative for it. However if you say that it’s not going to be outside the 3339 specs I’m just gonna split it and parse it by chunks…

There are a few solutions on stack overflow

Indeed! I’d forgotten how annoying parsing dates is with the standard library in python…