I was recently faced with the need to transfer some old files via USB so they could be centrally located and carefully vetted for future use, if any. Prior to copying them, via Robocopy and the command line of course, I took a quick look and saw lots of Mac hidden files.
They don’t really pose a problem but I wanted to get rid of them to speed up the transfer and to help my CDO. (That’s Obsessive Compulsive Disorder, but with the letters in their correct alphabetical order)
At a command prompt I changed to the network drive letter and typed the following commands:
del /s /q /f /a:h .DS_Store
del /s /q /f /a:h ._*
Just what the switches do can be found by typing /? after the command, so “del /?’ shows that:
/s will delete the specified files from all the subdirectories
/q is for quiet mode, it won’t prompt if you use a global wildcard
/f will force deleting of read-only files
/a:h will select files based on attributes, in this case hidden files.
A word of caution to those wishing to be wise. Typing “del .” and then hitting Enter is not a good idea. Any time you use “del” at the command prompt you are one keystroke away from A Really Bad Day™.