To delete directories on UNIX with special characters in their name or that are named after environment variables, you can use the following steps:
Example: rm -r 'my[folder]'
or rm -r "$HOME/my_folder"
Example: rm -r my\[folder\]
Example: find . -type d -name 'my[folder]' -exec rm -r {} \;
or find "$HOME" -type d -name 'my_folder' -exec rm -r {} \;
Note: Use caution when using the "rm" command, as it permanently deletes files and directories without confirmation. Double-check the directory name or environment variable before executing the command.
Asked: 2022-03-22 11:00:00 +0000
Seen: 10 times
Last updated: Jun 17 '21