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

  • The Easiest Ways to Find Large Files on WindowsThe Easiest Ways to Find Large Files on Windows
    a quick and effective solution is to identify and delete large, space-consuming files that are hiding on your computer.
  • The command bootcfg delete in WindowsThe command bootcfg delete in Windows
    the bootcfg delete command deletes the operating system entry in the [operating systems] section of the boot.ini file. the command applies to: windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012.
  • How to Create and Delete Files and Directories from Windows Command PromptHow to Create and Delete Files and Directories from Windows Command Prompt
    this wikihow teaches you how to use the windows command prompt to create and delete files and folders (also known as directories). the files you create at the prompt can be modified and managed with windows apps, including file manager and...
  • How to Delete Read-Only Files on LinuxHow to Delete Read-Only Files on Linux
    there are several ways to help you delete files read-only on linux. if it's a file you own, you can change the file permissions or use the sudo command to delete the original file. however, if you cannot delete files with write permissions (or see a 'read only file system' error message), you need to change the drive with the appropriate permissions. this article will show you how to delete read-only files on any linux distribution, including ubuntu and linux mint.
  • 10 useful commands in Windows you should know10 useful commands in Windows you should know
    command prompt is used to execute batch files, perform tasks quickly, help you troubleshoot and solve some windows problems when the system crashes. however, not all commands in windows are useful and must be done regularly. with the 10 command lines in the following article it is very useful even if you are not an administrator.
  • How to completely delete a file in Linux so that it cannot be restoredHow to completely delete a file in Linux so that it cannot be restored
    in linux, files can be deleted but can still be recovered. these are things to do when you really want them to disappear.
  • Fc command in WindowsFc command in Windows
    the fc command compares two files or a collection of files and displays the differences between them.
  • How to Delete a File Using Command PromptHow to Delete a File Using Command Prompt
    this wikihow teaches you how to delete a file from your pc's desktop by using a command in command prompt. locate your file. if you know where the file is, you can navigate to it by simply opening the appropriate folder. for example, if...
  • How to fix Windows file system errors with a single commandHow to fix Windows file system errors with a single command
    when you install windows on your computer, it will put a lot of important files into your system that you may not know or use. however, when they fail, it will cause many problems for your computer. let us find a way to fix it!
  • Comp command in WindowsComp command in Windows
    the comp command compares the content of two files or gathers files in bytes. if used without parameters, the comp command will prompt you to enter files for comparison.