Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Question:

Question: Reverse this command, cd ~/library/caches;rm -rfv *

Hello,

need to reverse this command, lost a lot of files.


cd ~/library/caches;rm -rfv *


Any wise person that can help me ?


Thanks

J.B

Posted on

Reply

There’s more to the conversation

Read all replies

Page content loaded

Mar 11, 2018 5:56 AM in response to johan644 In response to johan644

Sorry, but those files are gone - that is what rm does, after all. The cache folder is used by the system and applications to stash stuff for quicker reloading in the future, so if something is missing the application should just reload it if it is still available. If you really need those particular files, your options are to restore from a backup, or use a data recovery application or service.

Mar 11, 2018 5:56 AM

Reply Helpful

Mar 11, 2018 6:00 AM in response to johan644 In response to johan644

There is no reverse.


If you have a backup, you can maybe get the files from there, but some backup Utilities do not backup caches, as a cache can always be rebuilt.


Were you not really in the ~/Library/Cache? And you deleted files in your home folder? Or somewhere else valuable?

Mar 11, 2018 6:00 AM

Reply Helpful

Mar 11, 2018 8:14 AM in response to johan644 In response to johan644

The ~/Library/Caches folder is used by the operating system and applications that you run for frequently accessed information during your current, and successive login sessions. Removing the entire contents of this Caches folder, rebooting, and emptying the Trash — will not lose user documents, but will slow interactive performance until the Caches contents are recreated.


All of us at one time or another, usually very early in our careers, have been bit at least once by the recursive option of the rm command. It has our respect, as it now does your own.

Mar 11, 2018 8:14 AM

Reply Helpful

Mar 11, 2018 10:59 AM in response to johan644 In response to johan644

That's a very dangerous command. I'd recommend never using it again. I suggest using the find command instead.


find ~/library/caches -exec ls {} \;

once you have established that you have the correct files, you change the ls to the remove command.


If you truly cannot replace the files, stop using the machine. Get an external drive. Install macos in the drive. Try some recovery app. It will need to be one that tries to recover deleted files. Should the data be valuable, I'd take the drive out and send it to drivesavers.com.


mac $ find ~/library/caches -exec ls {} \; | wc -l
  169372

amazing amount of files.

R

Mar 11, 2018 10:59 AM

Reply Helpful
User profile for user: johan644

Question: Reverse this command, cd ~/library/caches;rm -rfv *