1

I have a Mac running MacOS 12.3.1. I've noticed that all over my file system, there are hidden files from Microsoft apps (Word, Excel, PowerPoint, etc.) that start with ~$. All of these hidden files have similar names to files I've created in the past, but are often in different directories than the originals. For example, if I had created a file named name_of_file.docx, I might find a hidden file named ~$me_of_file.docx. I found this discussion thread that says these are temporary files used to store updates to a document before it is saved. However, even when I don't have any Microsoft files open, I can still find dozens of these files on my computer. I would probably ignore them except when I back up my files with Google Drive, all of those ~$ files get backed up too. So my question is, is there any way to stop these files from piling up on my computer, or at the very least, stop them from being backed up to Google Drive?

4

2 Answers 2

2

I know 2 ways of doing this (there might be more), through:

  • Finder
  • Terminal

Warnings:

  • Only do this if you are sure what this is about.
  • Erasing/deleting files that are usually hidden can lead to some programmes to malfunction and/or even render your system/OS/computer unusable! (Until you reinstall, that is.)
  • ~$ files generated by Microsoft Office (i.e., Word, Excel, etc.) are usually erased after the file has been closed. In some cases, like when files are saved on a cloud/online disk, the latter can "throw back" to the local disk those files, hence the question. Don't erase those shadow/hidden files if the main file is open. To be on the safe side, quit the application altogether before erasing/deleting any of those ~$ files.

Finder

  1. Open a folder/directory where you know you have shadow/hidden files (such as those starting with ~$ (usually generated by Microsoft apps such as Word, PowerPoint, etc.)
  2. Press cmd-shift-. (that is command, shift and period keys; source pcmag)
  3. Shadow/hidden files will appear
  4. Select individually or in batch as you usually do in Finder (individual click, click and shift-click, click and command-click)
  5. Delete it/them as usual in Finder
  6. As a precaution press cmd-shift-. again to hide shadow/hidden files.

Terminal (Source: my own trial and error)

  1. Launch Terminal (Applications → Utilities → Terminal)
  2. cd to the folder/directory where you have your ~$ generated files (e.g., cd ~/Downloads)
  3. List the files in the folder/directory (e.g., ls or ls -l)
  4. Although neither of the above example commands show shadow/hidden files, they will show files starting with ~$. If you want to see all hidden files, type ls -a or ls -al, etc.
  5. Type or copy-paste: rm '~$'*
  6. ls -l again to be sure the files have been deleted.

Explanation of the commands

  • cd = change directory
  • ~/ = root folder/directory of the current user/profile (root directory of the system is /, e.g., cd /)
  • ls = list (options are preceded with -, option l will list the files and folders/directories in the current folder/directory in vertical list format, option a will list all files and folders/directories including the hidden ones [those starting with a .], etc. Options can be combined, e.g., ls -al)
  • rm = remove (i.e., delete)
  • * = wildcard (thus rm '~$'* = remove files that start with ~$. Keep in mind that rm alone will not remove folders/directories, only files, for that you will have to lookup options such as -R, but beware of their danger - see the warnings above)
  • All Terminal commands have their manual. Simply type man the_command (e.g., man rm).

Hope this helps

0

Open your Terminal.app and change to the desire directory.

Start surveying your directory using:

find . -name "~*" -type f

Then delete unwanted Microsoft temp files using:

find . -name "~*" -type f -delete
  • . current directory.
  • -name = "~*" :: name begin with ~
  • -type f filter object type is File
  • -delete delete match output

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .