I understand I can use find . -name ".DS_STORE"
to find all the .DS_STORE files in the current folder and all subfolders. But how could I delete them from command line simultaneously? I found it's really annoying to switch back and forth to all folders and delete it one by one.
Thanks for any advice.
You can also use extended globbing (
**
):in zsh, bash 4 and similar shells (if not enabled, activate by:
shopt -s globstar
).Make a new file with a text editor, copy and paste the following text into it, and save it with the ".sh" file extension, then open the file with Terminal. Make sure the text editor is actually saving the raw text and not saving the file as a Rich Text Format file or some other text file format with additional information in the file.
find
can do that. Just add-delete
:Here is how to remove recursively the .DS_Store file
Open up Terminal In the command line, go to the location of the folder where all files and folders are: cd to/your/directory
Then finally, type in the below command:- find . -name '.DS_Store' -type f -delete
Press Enter
Cheers!!