How to remove hidden files in several folders (OS X 10.5)

We use OS X 10.5 for our file server, in an attempt to copy the files for one server to another, all files in the server had a 4kb hidden file created - i.e. identical file name, but only 4kb and the filename prefix is ".<space> " pls see screen shot.

I do not know if the hidden files are used by POSIX access rights control or due to some freak tool we used to copy/sync the folders.

Does anyone know of a unix script or command I can use to delete all these ". <filename>" from all the folders?

Who is Participating?
omarfaridConnect With a Mentor Commented:
try this:

first do a listing to make sure that these are the files you want to delete

find /path/to/parentdir -type f -name '. *'

second do the actual removal

find /path/to/parentdir -type f -name '. *' -exec rm {} \;


find /path/to/parentdir -type f -name '. *' | xargs rm
artradisAuthor Commented:
Thanks. I think this will work. But now the OS X is not able to see any hidden files so the find returns nought.

I will find a command to turn on viewing of hidden files in OS X.  Thanks.
grahambowmanConnect With a Mentor Commented:
open terminal and type

defaults write AppleShowAllFiles ON

then go to the apple menu and Force Quit and choose Finder, do what you need to do then in terminal type

defaults write AppleShowAllFiles OFF

then relaunch Finder again and you will be back where you started
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.