
If you suspect that a particular file may be preventing you from emptying the Bin, you can forcefully delete this file while it’s inside:Ģ. If the Bin only contains a handful of files, you may be able to check each of these files manually by Ctrl+ clicking each file, then selecting “Get Info.” If you discover a locked file, you can unlock it using the steps listed earlier in this article. You can do this by clicking on the magnifying glass in the top right of your toolbar before tying “terminal” in the search bar and clicking on “terminal.app.” To force-delete a file, open your Mac’s Terminal. This technique can also delete files you wouldn’t normally be able to delete – and sometimes Apple has a very good reason for protecting certain files! Force-delete is a useful technique but should be used with caution. If you realize you’ve made a terrible mistake, there’s no way to recover the file. Just be aware that force-delete doesn’t send the file to the Bin – it permanently and immediately deletes the file in question. If all else fails, you can force-delete the file using a Terminal command. None of the Above Fixes Work? Try Force Delete Besides deleting files that won’t delete, you can also use this app to sweep away anything that’s taking up unnecessary space on your computer.
#REMOVE FILES FROM MAC OS X PRO#
For example, rm -R Originals removes the directory named Originals even if it is not empty ( Figure 26).One which you might be worth checking out is Cleaner One, which allows you to easily remove files you want to get rid of on your Mac.Īlternatively, you may want to consider WeClean Pro instead. The rmdir command will result in an error message if the directory you are trying to remove is not empty ( Figure 26). The second, using the rm -R command string, does the job.

The first, using the rmdir command, is not successful because the directory is not empty. This example shows two attempts to delete a subdirectory. For example, rmdir Originals removes the subdirectory named Originals in the current directory ( Figure 26).įigure 26. You may want to include the -i option (for example, rm -Ri * Figure 25) to confirm each deletion so you do not delete files or subdirectories by mistake. If you enter this command in the root directory ( /), you will erase the entire disk (if you have permission). This is the most dangerous command in all of Unix. To remove all files & subdirectories in a directory Since the rm command cannot remove directories without the -R option, an error message may appear when you use the rm * command string in a directory that contains subdirectories ( Figure 25). You may want to include the -i option (for example, rm -i *) to confirm each deletion so you do not delete files by mistake. In the second, the -Ri options delete all contents with confirmation the only item still in the directory is the subdirectory named dir30. In the first, the rm * command string deletes all files in the directory, but not the subdirectory named dir30. To remove all files in a directoryįigure 25. For example, rm *.bak removes all files ending with. Type rm followed by the wildcard search string and press. To remove files using a wildcard character For example, rm file1 removes the file named file1 from the current directory ( Figure 24). Type man rm or man rmdir and press to view each command's man pages. You can learn more about the rm and rmdir commands and their options on their man pages. If you are deleting a non-empty directory, you must use the -R (recursive) option. The rm command's file operand can be a file or a directory name. The -R option can be very dangerous you may want to use it in conjunction with the -i option to confirm each deletion. R, which stands for recursively, tells the rm command to delete everything within a directory, including its sub-directories and their contents.

The rm command in action, with and without the -i option. This is especially useful when using the rm command with wildcard characters, since it can help prevent files from being accidentally deleted.įigure 24. You must press and then at each prompt to delete the file. i tells the rm command to ask permission before deleting each file ( Figure 24). There are two options that you may want to use with the rm command: Because Unix doesn't have a Trash that lets you recover mistakenly deleted files, when you delete a file, it's gone forever. Rm may be the most dangerous command in Unix. Unix includes two commands that you can use to delete files and directories: rm (remove) and rmdir (remove directory).

Removing Files & Directories with rm & rmdir
