I recently came across a client’s computer that had a tremendous number of hidden files that were causing problems. I tried many different ways to delete these, unsuccessfully. Unfortunately, there were about 80,000 hidden files nested within hundreds of directories. Here is the code that I used to delete them:
First cd to the root directory where you want to start deleting. Then execute the following code:
find . -name "\._*" -type f -delete
Most of the hidden files will start with ‘._’ but some may still remain. For me it was .DS_Store and .FBCLockFolder. To delete these, I executed just searched using the finder by selecting ‘other’ in the search criteria and scrolling to visibility. Then select invisible. Make sure the search scope is only in the folder you want to search. Then just select all and delete.