JeromeJia

Q: Use terminal to delete the DS_store. Why all of my files disappeared?

the order is 

   find ~-type f-name.DS_store -delete. 

 

All my files disappeared. All folds were empty.

MacBook Pro with Retina display, OS X Mavericks (10.9.2)

Posted on May 7, 2014 2:47 AM

Close

Q: Use terminal to delete the DS_store. Why all of my files disappeared?

  • All replies
  • Helpful answers

  • by peter_watt,

    peter_watt peter_watt May 7, 2014 3:49 AM in response to JeromeJia
    Level 3 (910 points)
    May 7, 2014 3:49 AM in response to JeromeJia

    There are spaces missing, but in any case if you are going to use this kind of command it may have been better to do it first without the -delete just to see what it found.

     

    is -delete the right command?

  • by Christian A. Burkert,Solvedanswer

    Christian A. Burkert Christian A. Burkert May 12, 2014 3:34 PM in response to JeromeJia
    Level 2 (305 points)
    May 12, 2014 3:34 PM in response to JeromeJia

    As ahi there,

     

    as peter_watt already has written, there are spaces missing.

     

    If you entered the command in the way you described in your message, the find command discards everything between ~ and the space before -delete. So find assumes -delete is the only parameter and thus deletes everything from the directory you are currently in downwards.

     

    The correct parameters for the operation you wanted to execute are [without quotation marks]:

     

    "find . -name ".DS_Store" -delete"

     

    If you replace the "." with a "/", find searches from the top level (aka root) directory downwards. Using a "~" instead makes find search your home directory.

     

    As a side note, it is not the best idea to remove the .DS_Store files from any OSX related directories, since those files do contain information necessary for OSX to work properly.

     

    However, removing those files from network shares accessed by other operating systems as well can be useful.