Equivalent of ls' "--directory" option


Is there any smart way to make the lsjson command not list the content of directories but list the directory itself (like it does for files)? Something similar to the --directory option in ls.

I'm in a case where it would be especially useful. My current workaround is to list the parent directory and find my file or directory in it. This is not very elegant nor very efficient. If there isn't a better workaround, would a contribution adding this feature have a chance to get merged? I've dug a bit into the source code but unfortunately I don't see a non-intrusive way to implement it, any input would be appreciated :smile: .

Thanks once again for the amazing work achieved. rclone is really an outstanding FOSS project :heart: .

Perhaps it is possible to achive what you want with filtering? For example the following:

rclone lsjson remote:path --include **/

That's a good idea but I don't know in advance if the file I want to ls is a file or a directory. Using this filter will only work for directories. Though using a filter is probably a good idea. My only issue is that filters doesn't seem to work on directories for lsjson: I'd expect this rclone lsjson myremote:some/path/ --include 'myfile.txt' --include 'myfile.txt/' --exclude '**' to ignore all directories, but it doesn't.


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.