Can anyone give me a bash script or one line command i can run on linux to recursively go through each folder from a root folder and delete all files or directories starting with '._'?
Thanks, Dane.
Can anyone give me a bash script or one line command i can run on linux to recursively go through each folder from a root folder and delete all files or directories starting with '._'?
Thanks, Dane.
Change directory to the root directory you want (or change .
to the directory) and execute:
find . -name "._*" -print0 | xargs -0 rm -rf
xargs
allows you to pass several parameters to a single command, so it will be faster than using the find -exec
syntax. Also, you can run this once without the |
to view the files it will delete, make sure it is safe.
I've had a similar problem a while ago (I assume you are trying to clean up a drive that was connected to a Mac which saves a lot of these files), so I wrote a simple python script which deletes these and other useless files; maybe it will be useful to you: