Find and delete all .DS_Store files with a single command

If you are a Mac OS X user, you are no stranger to the '.DS_Store' file. The .DS_Store file is automatically generated by the system every time you open a folder.

What the ".DS_Store" file does is to store the folder properties, such as the location of the icon or the selection of wallpaper, so in the next time you open a folder. , it will remain the same as the previous version.

By default, the '.DS_Store' file is hidden, and most of these files do not affect the system. However, when you compress a folder and send it to a friend (used on another operating system) or upload a folder to the server, you will encounter some problems.

If you want to quickly delete all the '.DS_Store' files in a folder, you can refer to the following article of Network Administrator.

Find and delete all .DS_Store files with a single command Picture 1

If you want to quickly delete all the '.DS_Store' files in a directory, you only need to use one command below:

Note:

The following command works on Linux.

1. Open your Mac OS X computer Terminal.

2. Next enter the following statement into the Terminal window:

find / path / to-folder (-name '.DS_Store') -delete

Replace '/ path / to / folder' with the directory path, such as "/ var / www / html".

In the above statement, use the find command to search for a specific directory containing the ".DS_Store" file and delete these files when detected.
From now on you can easily delete all ".DS_Store" files before sharing the folder to other users.

Refer to some of the following articles:

  1. 7 commands to manipulate the most basic files and folders everyone must know
  1. These "hack" tips are only Notepad can do
  1. Summary of how to fix errors without downloading files, not accessing YouTube and Not Responding errors on Chrome browser

Good luck!

3.7 ★ | 10 Vote

May be interested

  • Use CMD to delete large folders on WindowsPhoto of Use CMD to delete large folders on Windows
    large directories on the system are one of the culprits that consume a lot of system space. a lot of folders that you create, after deleting, will come back later. maybe it's junk folders that you try to remove.
  • Here's how to uninstall the Product key on a Windows computerPhoto of Here's how to uninstall the Product key on a Windows computer
    removing the product key installation on a windows computer allows you to replace the other license key to re-enable the use of your windows computer. in particular, it is extremely useful in case you were previously using a trial license key, illegal pirated or key license key
  • How to Stress Test Hard Drives on Your Computer or Server?Photo of How to Stress Test Hard Drives on Your Computer or Server?
    do you want to know which hard drive is the fastest and is it really fast as committed by the manufacturer? no matter whether your pc or server, the free diskspd utility will stress test and benchmark your hard drives.
  • The trick prevents Windows from automatically updating specific driversPhoto of The trick prevents Windows from automatically updating specific drivers
    on windows operating systems, especially windows 10 usually automatically installs driver updates for hardware even if required or not required. if you do not want to automatically update dirver, you can proceed to prevent windows from automatically updating the driver. if you are using windows pro or enterprise version, you can use group policy editor to prevent windows from automatically updating drivers.
  • Instructions to format USB Pendrives with Command PromptPhoto of Instructions to format USB Pendrives with Command Prompt
    by default, windows users can usually format the hard drive, memory card, or usb by right-clicking on it and clicking the format option.
  • No need to install any software, this is how to find the Windows Product KeyPhoto of No need to install any software, this is how to find the Windows Product Key
    suppose you intend to reinstall windows, but you do not know or do not remember the product key to activate windows after the installation is completed and you cannot activate the newly installed operating system.