Coding⏱️ 2 min read📅 2026-05-31

How to Fix: rm -rf all files and all hidden files without . & .. error

Remove all files and hidden files recursively without . & .. error

Quick Answer: Use `rm -rf /some/path/*` for non-hidden files, then `find /some/path -type f -print0 | xargs -0 rm` for hidden files.

To remove all hidden and non-hidden files and folders recursively in a target directory without receiving the warning/error about . and .., you can use the following methods:

✅ Best Solutions to Fix It

Method 1: Using find

  1. Step 1: Open a terminal and run the following command: `find /some/path -type f -exec rm {} "

Method 2: Using rm with options

  1. Step 1: Open a terminal and run the following command: `rm -rf --ignore-blacklist /some/path/.*` (Note: This method will not remove directories)

💡 Conclusion

By using one of these methods, you can safely remove all hidden and non-hidden files and folders recursively in a target directory without receiving the warning/error about . and ...

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions