Does anyone have a solution to remove those pesky ._ and .DS_Store files that one gets after moving files from a Mac to A Linux Server?
specify a start directory and
Simple command:
rm `find ./ -name '.DS_Store'` -rf
rm `find ./ -name '._'` -rf
Good luck!
This also works:
sudo rm -rf 2018-03-*
here your deleting files with names of the format 2018-03-(something else)
keep it simple
Example to delete "Thumbs.db" recursively;
find . -iname "Thumbs.db" -print0 | xargs -0 rm -rf
Validate by:
find . -iname "Thumbs.db"
This should now, not display any of the entries with "Thumbs.db", inside the current path.
find /var/www/html \( -name '.DS_Store' -or -name '._*' \) -delete
if you have Bash 4.0++
#!/bin/bash
shopt -s globstar
for file in /var/www/html/**/.DS_Store /var/www/html/**/._
do
echo rm "$file"
done
A few things to note:
'-delete' is not recursive. So if .TemporaryItems (folder) has files in it, the command fails.
There are a lot of these pesky files created by macs: .DS_Store ._.DS_Store .TemporaryItems .apdisk
This one command addresses all of them. Saves from running find over and over again for multiple matches.
find /home/foo \( -name '.DS_Store' -or -name '._.DS_Store' -or -name '._*' -or -name '.TemporaryItems' -or -name '.apdisk' \) -exec rm -rf {} \;