I often treat directory and file names interchangeable in copy operations (often with a leading ‘/’ but with roughly same meaning).
I want to copy all directories inside my projects directory but not the ones that are git tracked as they’d have git upstream.
Specifying a directory name in --exclude-if-present errors out:
$ rclone ls test --exclude-if-present '.git'
2025/08/13 03:49:59 ERROR : error listing: is a directory not a file
2025/08/13 03:49:59 NOTICE: Failed to ls with 2 errors: last error was: is a directory not a file
The error is not very clear about what is a directory and not a file, probably having an error like .git is a directory not a file would make more sense here anyway.