I have obtained the Microsoft Sysinternals SDelete software for the purpose of securely deleting files on my laptop. After reviewing the documentation and help resources, I discovered that the “-s” option enables the deletion of files in subdirectories, while the “-r” option removes the read-only attribute. To utilize these options, I input the appropriate command in an administrator prompt:
sdelete -s -r c:\Users\guest\Documents
Whenever I attempt to delete the directory at “path/to/directory”, I consistently encounter an error message stating “The directory is not empty“. Is there a resolution to this issue that doesn’t entail executing a command for each subdirectory individually? I have also attempted to use sdelete64, but I experienced the same outcome.
Although I am not concerned with files that cannot be erased due to being in use or any other reason, I would like to remove as many as possible.
Thank you for any assistance you can provide.
2 Answers
Introduction
When it comes to disposing of a laptop or simply getting rid of files, it is important to ensure that the data is completely wiped out from the device. This is because the data could be sensitive and confidential, and leaving it on the device could lead to a potential data breach. One way to wipe out files from a laptop is by using the Microsoft Sys-internals SDelete. However, sometimes, users encounter errors while trying to use this tool. In this blog post, we will explore how to safely wipe out files from a laptop using SDelete and how to resolve the error message that users might encounter.
What is SDelete?
SDelete, developed by Microsoft Sysinternals, is a command-line utility that securely deletes files, directories, and free space on a disk. It overwrites the data with zeros or random numbers to ensure that it cannot be recovered. SDelete is a free tool that can be downloaded from the Microsoft website.
How to Use SDelete to Wipe Out Files from a Laptop
To use SDelete to wipe out files from a laptop, follow the steps below:
Step 1: Download SDelete
The first step is to download SDelete from the Microsoft website. Once downloaded, extract the files to a folder on your laptop.
Step 2: Open Command Prompt
Next, open the Command Prompt as an administrator. To do this, search for “Command Prompt” in the Start Menu, right-click on it, and select “Run as administrator.”
Step 3: Navigate to the SDelete Folder
Navigate to the folder where you extracted the SDelete files using the “cd” command. For example, if you extracted the files to the Downloads folder, you would type “cd DownloadsSDelete” and press Enter.
Step 4: Wipe Out Files
To wipe out files, use the following command: sdelete -s -r C:pathtofolder
. For example, if you want to wipe out the files in the Documents folder, you would type sdelete -s -r C:UsersusernameDocuments
and press Enter. This will recursively wipe out all the files in the folder and its subfolders.
Resolving the Error Message
Sometimes, users might encounter an error message while trying to wipe out files using SDelete. The error message might read, “Error deleting path/to/directory: The directory is not empty.” This error message occurs when there are subdirectories within the directory that you are trying to wipe out. To resolve this error message, you can use the following command instead: sdelete -s -r -c C:pathtofolder
. The “-c” option tells SDelete to zero out the free space in the folder and its subfolders. This will ensure that all the files are wiped out, including those in the subdirectories.
Conclusion
Wiping out files from a laptop is crucial to ensure that sensitive and confidential data is not left behind. SDelete is a free tool that can be used to securely delete files, directories, and free space on a disk. However, users might encounter an error message while trying to use SDelete. The error message occurs when there are subdirectories within the directory that you are trying to wipe out. To resolve this error message, you can use the “-c” option to zero out the free space in the folder and its subfolders. By following the steps outlined in this blog post, you can safely wipe out files from your laptop using SDelete.
I abandoned the idea of using SDelete to erase a directory tree directly. Instead, I opted for an alternative method to delete all of a user’s data (after backing it up) by following these steps:
- Create a new local administrator user without a Microsoft account, such as “newadmin”.
- Log in as the user whose data needs to be deleted, such as “myuser”, and then sign out by clicking the top-left icon after clicking the start button.
- Log in again as “newadmin”, access settings, choose “myuser”, and remove the account while selecting the option to delete all data.
- Most of the data should be gone at this point, but for thoroughness, navigate to Windows Explorer and delete the entire “\Users\myuser” folder. Afterwards, empty the recycle bin.
- There should now be a significant amount of free space reported by Windows 10. Finally, an administrator prompt can be used to zero out this free space that may still contain data by using SDelete.
sdelete64 -z c:
I chose to keep the default one-pass setting when using SDelete because it is suitable for my requirements and because the disk I used is an SSD.
If you simply wish to delete a random folder, you can do so by completing the last step after performing the standard deletion procedure in Windows.
I also discovered that on Windows 10, it is possible to select “Settings > Recovery > Reset this PC” and opt for “Remove files and clean the drive” during the process, which is intended to provide a more effective approach to deleting files when passing on the computer, as opposed to the standard reset.