The structure of the subfolders a/ and b/ of /h/ shall continue in /h/ for subfolders c/, d/, ...
Command: rclone lsf mcrypt:/h/a
Result:
a1/
a.txt
Command: rclone lsf -R mcrypt:/h/a
Result:
a1/
a.txt
a1/a1.txt
Now I want to list several folders in /h/ with a filter. Let's say a/ and b/. I got it working recursively using rclone lsf -R mcrypt:/h --include "a/**" --include "b/**"
What I want to achieve now is listing the contents of the included subfolders without recursion, displaying files and folders.
So the desired output would look like this:
a/
a/a1/
a/a.txt
b/
b/b1/
b/b.txt
I tried the following command rclone lsf -R mcrypt:/h --include "a/*" --include "b/*"
a/
a/a.txt
b/
b/b.txt
As you can see, the output of the folders a1 and b1 is omitted. I tried some other variations of the command but was not able to achieve the desired output.
Is it possible to do it with just one command?
You can't use a glob in there as it shouldn't work. Can you share full output of those commands with -vv --dump-filters?
felix@gemini:~/test$ rclone lsf DB:test -R
h/
h/a/
h/b/
h/b/b.txt
h/b/b1/
h/a/a.txt
h/a/a1/
h/b/b1/b1.txt
h/a/a1/a1.txt
felix@gemini:~/test$ rclone lsf "DB:test/h/a/*/" -R
2021/11/27 07:29:47 ERROR : : error listing: directory not found
2021/11/27 07:29:47 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found
felix@gemini:~/test$ rclone lsf "DB:test/h/a/*/ " -R
2021/11/27 07:29:51 ERROR : : error listing: directory not found
2021/11/27 07:29:51 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found
rclone filters on files and prints files out which I think is the confusion. Your output won't work as it won't ever print a/a1 like you have since no files match.
--- start filters ---
--- File filter rules ---
+ (^|/)a/[^/]*/ $
- ^.*$
--- Directory filter rules ---
+ (^|/)a/[^/]*/$
+ (^|/)a/$
- ^.*$
--- end filters ---
2021/11/29 02:03:06 DEBUG : rclone: Version "v1.57.0" starting with parameters ["D:\\Userdata\\bin\\rclone.exe" "lsf" "-R" "mcrypt:/h/" "--include" "a/*/ " "-vv" "--dump" "filters"]
2021/11/29 02:03:06 DEBUG : Creating backend with remote "mcrypt:/h/"
2021/11/29 02:03:06 DEBUG : Using config file from "C:\\Users\\myname\\.config\\rclone\\rclone.conf"
2021/11/29 02:03:06 DEBUG : Creating backend with remote "mdrive:/kh/8ecjk22tnvfejgul0s1j4bfq7g"
2021/11/29 02:03:07 DEBUG : fs cache: renaming cache item "mdrive:/kh/8ecjk22tnvfejgul0s1j4bfq7g" to be canonical "mdrive:kh/8ecjk22tnvfejgul0s1j4bfq7g"
2021/11/29 02:03:07 DEBUG : fs cache: switching user supplied name "mdrive:/kh/8ecjk22tnvfejgul0s1j4bfq7g" for canonical name "mdrive:kh/8ecjk22tnvfejgul0s1j4bfq7g"
2021/11/29 02:03:08 DEBUG : b: Excluded
2021/11/29 02:03:08 DEBUG : a/a.txt: Excluded
a/a1/
2021/11/29 02:03:08 DEBUG : a/a1/a1.txt: Excluded
2021/11/29 02:03:08 DEBUG : 4 go routines active
The log for the combination rclone lsf -R "mcrypt:/h/" --include "a/*/ " --include "a/*" -vv --dump filters was correct in my last post and indeed is the output I want. I don't understaand the workings though because as you wrote above the filters with single * are supposed to apply to files only and not folders.
Sorry as I didn't quite state it well/correct. A * will match one directory and a ** will match recursively as that is what I trying to say in a better fashion.
You can play around with the filters and test things as it's not quite perfect since rclone will evaluate a directory match and a file match based on the filters you can see in the debug: