What happens when you empty Trash?

When you delete a file on your computer, it doesn’t actually disappear right away. Instead, the file gets moved to your computer’s Trash or Recycle Bin. This allows you to easily recover deleted files, in case you deleted something by accident. However, once you empty the Trash or Recycle Bin, those deleted files are gone for good.

What exactly happens when you empty the Trash/Recycle Bin?

When you empty the Trash or Recycle Bin, your computer will immediately delete all the files that were being stored there. This means the operating system will mark the space used by those files as being available for reuse. The actual data that makes up those files isn’t removed right away though.

Instead, the area of the hard drive where that data resides will simply be marked as available space. Until new data overwrites it, the original data from the deleted files is still physically present on the drive. But it is inaccessible, because the operating system no longer has it registered in its file system.

This is important to understand, because it means that forensic data recovery tools may still be able to recover files for some time after they have been deleted and the Trash or Recycle Bin has been emptied. The longer you continue to use your computer after deleting files, the higher the chance portions of the deleted data will get overwritten by new data.

Can you recover files after emptying the Trash/Recycle Bin?

If you need to recover a file that you’ve accidentally deleted and already emptied from the Trash, hope is not entirely lost. But act fast! The sooner you attempt to recover the data, the better your chances are.

Here are some ways you may be able to get the deleted files back:

  • Use data recovery software. There are many third party utilities available that can scan your drives and attempt to assemble deleted files by scanning for the residual data.
  • Send your drive to a data recovery service. For very important files, you can employ a specialist data recovery company who have access to advanced tools to reconstruct data. This can be expensive though.
  • Restore from a backup. If you have backups available (and you should!), you may be able to restore the deleted files from a backup created prior to emptying the Trash.

The overall chance of success depends heavily on how much new data has been written to the drive since the files were deleted. The tips below can help avoid overwriting deleted data that you may later need to recover.

Tips for increasing chances of recovery

  • Avoid writing new data to the drive. The more you continue to use the computer, the higher chance that deleted file data will get overwritten with new data.
  • Use recovery software as soon as possible. The less time that elapses between deleting files and running data recovery software, the better.
  • Store deleted files on an external drive. If you accidentally deleted important files, connect an external hard drive and use recovery software to scan and restore the files there. This avoids overwriting them on the original disk.

Why can data still be recovered after emptying the Trash?

As mentioned above, when you first delete a file, either through your computer’s file manager or an application, it gets moved to the Trash or Recycle Bin. No data is actually removed from the drive at this point. All that happens is your operating system changes its index and file allocation tables to mark the space used by that file as being available for future writes.

It’s only when you choose to empty the Trash or Recycle Bin that the operating system will complete the deletion process. But all this does is remove the file system-level information about where those files existed on the drive. The actual 1s and 0s that make up the file contents remain on the physical disk surface until they eventually get overwritten by new data.

This is why data recovery tools are often able to restore deleted files, even after you empty the Trash. The data is still there in many cases, it just needs to be reassembled based on scanning the contents of the drive and reconstructing files based on file signatures for known file types.

Factors that affect recoverability of emptied Trash

If you need to recover a deleted file after emptying the Trash, the chances of success depend on these factors:

  • Time elapsed – The less time between deleting a file and attempting recovery, the better. More time equals more potential for overwritten data.
  • Drive usage – The more the drive is used after deleting files, the higher chance of data being overwritten.
  • Drive space – When the drive has more free space, it takes longer for the deleted file’s data clusters to be reused.
  • File size – Larger files means more data clusters that could potentially be overwritten.
  • File system – Some file systems handle deletions in ways more conducive to recovery.

Precautions for avoiding accidental data loss

While there are techniques for recovering deleted files from emptied Trash, prevention is the best solution. Here are some tips to avoid accidentally losing data:

  • Be very careful when emptying the Trash. First check to verify it only contains files you want to delete.
  • Enable a Trash warning prompt before emptying it.
  • Setup backups so you have copies of your files.
  • Use version control systems and source code repositories.
  • Enable file recovery features offered by cloud storage services.
  • Store important files on media that you can physically control like external drives.

What gets deleted when emptying the Trash/Recycle Bin?

Emptying the Trash or Recycle Bin will permanently delete all files and folders that have been moved there after deletion. This includes:

  • Files you have deleted through the file manager or other applications.
  • Files deleted by third-party programs or scripts.
  • Folders that were deleted, including all contents recursively.
  • Any other disk items moved to the Trash folder.

Files will be deleted regardless of type, size, extension, permissions, or other attributes. The entire contents of the Trash will be permanently removed.

However, system files that are protected will not be actually deleted, only moved back to their original location after being “deleted” to the Trash. Protected system files include:

  • Windows system files stored in C:\Windows.
  • Program and application files stored in Program Files.
  • Files marked as system files, hidden files, or read-only.

Permanently deleting files without Trash/Recycle Bin

In some cases you may want to permanently delete files without placing them in the Trash first. This can be done a few different ways:

  • Delete using Shift+Delete to bypass the Trash.
  • Delete files from the command line using rm or del commands.
  • Use a secure delete tool that overwrites data before deletion.

Bypassing the Trash will immediately remove the file system-level information about those files. But again, the actual data still exists on the drive until overwritten by new data. So undelete tools could still potentially recover the files.

Does emptying the Trash free up disk space?

Yes, emptying the Trash or Recycle Bin will immediately free up disk space on your drive occupied by the now deleted files. The data still physically exists on the drive until overwritten, but as far as the operating system is concerned, that space is now available for new data to be written to.

The amount of disk space freed up when emptying the Trash will vary depending on how many files were in the Trash and their combined size. For example, if you deleted 2 GB worth of files to the Trash, then emptying it would mark that 2 GB as being available again.

To check how much space is being used by the Trash and could potentially be freed up, right click on the Trash icon and view its properties, which will display size information.

Does space get freed up immediately?

The space used by the now deleted files is marked as available immediately as soon as you empty the Trash. However, actual physical disk usage as reported by the operating system may not decrease right away.

This is because of the way file systems allocate space in units called blocks. Even if a deleted file only occupied a portion of a block, the whole block has to be marked free. So the operating system may still report that block as being used until new data overwrites it, even if part of it is technically available for new data.

As long as plenty of free space exists on the drive, this discrepancy between actual and reported free space isn’t an issue. But it can cause confusion if you are anxiously trying to free up space on a nearly full disk.

Can you recover disk space without emptying the Trash?

If your Trash contains files you want to keep for now, but you need to immediately regain the disk space they are using, you have a couple options:

  • Use Trash compression features offered by some operating systems to reduce the size of Trash contents.
  • Move Trash contents to an external drive temporarily to free up space.
  • Delete unneeded files from Trash selectively rather than emptying entire Trash.

This allows you to free up disk space used by the Trash without having to permanently empty files you may want to recover later.

Emptying Trash on Solid State Drives vs Hard Disks

On traditional rotating hard disk drives, emptying deleted files from the Trash will leave the original data intact in the physical drive sectors until overwritten by new data. This makes recovery possible using disk scanning tools.

However, solid state drives (SSDs) handle deletions differently, making file recovery after emptying the Trash much more difficult.

Unlike hard disks, SSDs will immediately erase data after deleting files and emptying the Trash. The TRIM command effectively wipes deleted data by resetting all cells storing that data to an empty state. So on SSDs, emptying the Trash permanently destroys file contents almost instantly.

Securely wiping Trash contents

For enhanced security and privacy, you may want to completely wipe files stored in the Trash to prevent any chance of recovery before emptying it. This can be done using secure delete programs that overwrite the space used by Trash files multiple times with random data before deleting them.

Specific methods of securely wiping Trash contents include:

  • Using Trash/Recycle Bin wipe utilities included in some operating systems.
  • Employing third party secure deletion tools and apps.
  • Booting into a secure deletion live CD/USB environment.
  • Performing a full drive secure erase to wipe all existing data.

Note that SSDs make data nearly impossible to recover once Trash is emptied due to TRIM commands. So secure wipes may be unnecessary for SSDs.

Conclusions

When you empty the Trash or Recycle Bin, the operating system marks files stored there as permanently deleted and frees up the space they were using. But actual file contents remain on the drive until new data overwrites them.

This makes it possible to recover deleted files using data recovery software for some time after emptying the Trash – unless you are using an SSD. However, the chances of file recovery grow lower the more a drive is used after deletion.

To avoid unintended file loss, be extremely careful when emptying the Trash. Have backups available, and act quickly with file recovery tools if needed after an accidental permanent deletion. With proper precautions, you can usually avoid disaster.