I'd like to do an lsd or lsf or some similar command that lists any directory matching a certain string. The documentation for these commands says this is possible, but, it just isn't

So basically I’m trying to use lsd or lsf and I want --include “SOMETHING” to only show me results containing SOMETHING… yet instead I’m simply shown all directories.

Is there anyway to show me a list of directories that match a string? It’d be really helpful when using -R to make the command recursive, otherwise I get spammed and have trouble finding what I am looking for.

If this isn’t possible, it should at least be removed from the documentation that claims it is possible…

edit: Hopefully I’m just doing something wrong and it is possible and someone can point out what I’ve done wrong. Thanks.

Can you share what you are running and what the output is and what you are expecting?

rclone -v lsd --include “ackup” “crypt:folder”

Result: a list of all about 100 directories in “crypt:folder”
Desired Result: the list of one or two directories in “crypt:folder” that contain the string ackup in the directory’s name

alternatively of course lsf but… the desires and failures are the same.

It’s all on how your match is:


felix@gemini:~$ rclone lsd gcrypt: --include "TV"
          -1 2018-06-17 10:24:02        -1 Movies
          -1 2018-06-17 09:16:39        -1 Radarr_Movies
          -1 2017-04-18 16:14:26        -1 TV
          -1 2018-06-30 12:55:49        -1 TV_Ended

felix@gemini:~$ rclone lsd gcrypt: --include /TV*/
          -1 2017-04-18 16:14:26        -1 TV
          -1 2018-06-30 12:55:49        -1 TV_Ended

felix@gemini:~$ rclone lsd gcrypt: --include /TV*/
          -1 2017-04-18 16:14:26        -1 TV
          -1 2018-06-30 12:55:49        -1 TV_Ended

The filtering commands match files by default. So when you say --include SOMETHING rclone is looking for files with that in - that is why it shows you all the directories as that file might be in any of them. If you want directories then you need --include SOMETHING/

This is alluded to here https://rclone.org/filtering/#directories as @Animosity022 pointed out.

thanks, sorry for being so inept!

also… new problem now :frowning:
rclone -v lsd --include “*ackup/” “crypt:folder”
but now I want to do rclone -v lsd --include “*backup/” -R “crypt:”
it doesn’t work, it returns nothing.
how do I make lsd or lsf work like lsl? Documentation says -R makes them recurse? but is it just not possible to do what I want here? and search subdirectories for directory names?

The directory filtering doesn’t seem to work very well for finding directories :frowning:

It was designed to find files, so if you search for directories, you’ll find all the directories that that directory could be in which isn’t really what you want.

I think you might be better off with rclone lsf -R --dirs-only and piping that into grep.

Okay cool, thanks, yeah, I can already just use my plaintext copy of lsf or whatever to do this job. I was just wondering if what I wanted to do was possible, the fact you replied here means to me… that… I wasn’t being dumb, it’s just a limitation of rclone, and honestly not that important of a limitation, I should remember what sort of directory structure I’ve chosen to use, and if I can’t, well like you said, I can search the plaintext output of everything.

Not you being dumb at all! Perhaps I should document how the --include filters work with directories - in general they are all about searching for files, so they don’t really do what you expect with the ls commands! I’ve found this frustrating too BTW!