On linux a buggy script created folders with this : ^M at the end of the name. The ^M is moved to ? with a ls -al.
A search on the ? is not working as a search on ^M (or ^M)
How can I remove these folders?
On linux a buggy script created folders with this : ^M at the end of the name. The ^M is moved to ? with a ls -al.
A search on the ? is not working as a search on ^M (or ^M)
How can I remove these folders?
What you need is use a c-style string where you can specify the ^M or Carriage Return characters with its backslash escape \r.
A c-style string is made of $ and single-quotes: $'a c-style string'
Find the bugged directories:
find . -type d -name $'*\r'
List the bugged directory names:
ls -d *$'\r'
Rename the bugged directories by removing the trailing CR.
find . -type d -name $'*\r' -execdir sh -c $'for d; do mv -- "$d" "${d%\r}"; done' _ {} +
Delete the faulty named directories in current directory, with their content:
rm -r -- *$'\r'