A couple of days back, I noticed that my server has a almost 1000 plus hidden directories and files that are exact replicas. Let me give you an example.
Level 1 Directory has the following sub-directories and files:
- wp-content
- wp-includes
- index.php
- wp-mail.php
Now, I notice that along with these 4, there are hidden files like these:
- ._wp-content
- ._wp-includes
- ._index.php
- ._wp-mail.php
Also, if these sub-directories too have further sub-directories (several levels deep), the same duplication has happened over there too. I’m not sure how did that happen (might have happened when I migrated from site from one server to another).
Anyways, my question is how do I delete all these duplicate and hidden files with prefixes “._” (ignore quotes) – including ones that are 3-4 sub-directories deep. Also such that .htaccess files or other important files/directories are not deleted.
Mine is a WordPress site and I use Ubuntu 14.04 LTS.
You can use the
find
utility:or as an alternative
where
/path/to/search
has to be replaced by the base location in your local file system that you want to start the search in.