7

WD My Cloud NAS added hidden .wdmc folders to every folder with a jpg without notifying or asking me first. There are many hundreds on my NAS drive. It has something to do with their media server but I never turned that feature on. These folders are packed with data that bloats my backups and disk space usage. They have to be deleted but they are all over the disk and sometimes deep inside directory structures.

On Superuser.com I found this advice, ran it in Terminal, and it appeared to spend all night deleting these folders. However, it didn't delete the target folders or the data in them.

$ find . -type d -name '.wdmc' -print -exec echo rm -rf {} \; 

I also found this but it only worked for folders with no spaces in the name:

rm -rf `find . -type d -name .wdmc`

Somehow in the path there must be a way to escape the spaces in folder names?

2
  • I'm going to post the solution, if any, in my Amazon review for WD My Cloud NAS disks. My guess is that a lot of the product's 5 star reviews would be much less if users saw the mess that it causes.
    – Preston
    Aug 5, 2014 at 22:31
  • I finally gave up and used the second statement above to remove directories within folder trees when all folders had no spaces in the names. Then I used find . -type d -name .wdmc to find the remaining files, which was most of them, copied the results from Terminal to a text editor so I could narrow my search then used Finder with hidden files exposed to delete them. This ate piles of time but saved over 200 GB of space, made moving and deleting folders faster, and made cloud backup vastly faster. I detest Western Digital.
    – Preston
    Aug 6, 2014 at 23:40

3 Answers 3

9

Version 2 (piping via xargs)

After digging around in the manpage for find (see for example here) I found a solution that uses the print0 option and xargs to pipe the directory names to rm:

$ find . -type d -name '.wdmc' -print0 | xargs -0 rm -rf

This should also work for directory names containing spaces or other, non-ASCII characters.

Version 1 (only works for empty .wdmc directories)

Alternatively you could use the -delete option of find:

$ find . -type d -name '.wdmc' -delete
8
  • This doesn't work, and I tried again, because -delete will not remove non-empty folders. rm -r travels through those folders and deletes the contents before deleting the folder. rm -r works fine except it hates spaces in folders. Somehow I have to escape those spaces but I can't figure that out. I've done a lot of searching but all the suggestions I've found are for simple directory trees with names without spaces.
    – Preston
    Aug 5, 2014 at 22:29
  • YES! Version 2 above reaches deep into the directory trees and snuffs these folders and the files in them. Thank you! As word gets out that Western Digital carpet bombs storage with unwanted files without user permission or knowledge I'm sure this code will be appreciated by many. By the way, it took almost all day for me to test your script on just one directory. The My Cloud drive is a slug. I get better performance with a USB 2 HD attached to my Time Capsule.
    – Preston
    Aug 7, 2014 at 23:19
  • Remove -print0 and it prints activity :-)
    – Preston
    Aug 8, 2014 at 0:27
  • Or use xargs -0t ;-)
    – hakaze
    Aug 8, 2014 at 5:14
  • Yes, -0t works better. It wasn't always printing to the screen before.
    – Preston
    Aug 8, 2014 at 16:25
1

Have you tried:

$ find . -type d -name '*.wdmc' -print -exec echo rm -rf "{}" \; 

It works for me on my mac testing it with ls instead of rm.

1
  • Both of the methods I tried will find the .wdmc folders which are just like system folders. The problem is the path right after find. I need to search and delete inside a lot of folders and many are several deep in the directory structure. Find . won't search and remove in /foo bar/ but it will find the folders I want to remove. I tried your suggestion and the folders to be deleted are printed with path names but not removed. That is what happened with the first command I tried. I'm no command line wiz by the way :-) Complicated.
    – Preston
    Aug 4, 2014 at 22:28
0

You can use your finder-app too.

there is a search field in the upper right corner just type *.wdmc.

by default the search scope is your whole mac, but you can change it when you start the search. switch to your curent folder if you was on the top most directory the finder will recursively search for all files in this folder

than you can mark them all witch command+a and delete them

7
  • Thanks Chris but Finder doesn't work. No results even when in the folder with a .wdmc file. I can use Finder for searching through the folders, discovering, and deleting these folders but that is a huge time sink. Of course I have to use Terminal to fix Finder so it shows hidden files.
    – Preston
    Aug 5, 2014 at 14:12
  • you could try this:Type the following into a terminal window: defaults write com.apple.finder AppleShowAllFiles 1 from discussions.apple.com/thread/5483892 sory i have no OSX-Machine here to test this too :(
    – chris
    Aug 5, 2014 at 14:41
  • Yeah, as I mentioned above I did that. I can see these hidden folders in Finder and can delete them but Western Digital puts many hundreds of them in folders everywhere there is a jpg. I would spend many days finding and deleting them with Finder. Professional photographers complain about finding thousands of these folders! I'm about ready to toss the My Cloud NAS into the garbage and buy another brand.
    – Preston
    Aug 5, 2014 at 15:32
  • i dont know you folder struckture, but maybe i could be a good idea to delete the content in the folders and after that you could remove the write permission with chmod.
    – chris
    Aug 5, 2014 at 20:48
  • That would be a huge time sink also. Better to buy another drive and restore to that from my cloud backup. Probably not Western Digital again.
    – Preston
    Aug 5, 2014 at 22:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .