Looks like no one’s replied in a while. To start the conversation again, simply ask a new 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 Mar 11, 2018 4:50 AM

Reply
7 replies

Mar 11, 2018 5:56 AM 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 8:14 AM 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 10:59 AM 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

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

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.