Deleting files without windows

DeleteFile function (winbase.h)

Deletes an existing file.

To perform this operation as a transacted operation, use the DeleteFileTransacted function.

Syntax

Parameters

The name of the file to be deleted.

In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend «\?» to the path. For more information, see Naming a File.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero (0). To get extended error information, call GetLastError.

Remarks

If an application attempts to delete a file that does not exist, the DeleteFile function fails with ERROR_FILE_NOT_FOUND. If the file is a read-only file, the function fails with ERROR_ACCESS_DENIED.

The following list identifies some tips for deleting, removing, or closing files:

  • To delete a read-only file, first you must remove the read-only attribute.
  • To delete or rename a file, you must have either delete permission on the file, or delete child permission in the parent directory.
  • To recursively delete the files in a directory, use the SHFileOperation function.
  • To remove an empty directory, use the RemoveDirectory function.
  • To close an open file, use the CloseHandle function.

If you set up a directory with all access except delete and delete child, and the access control lists (ACL) of new files are inherited, then you can create a file without being able to delete it. However, then you can create a file, and then get all the access you request on the handle that is returned to you at the time you create the file.

If you request delete permission at the time you create a file, you can delete or rename the file with that handle, but not with any other handle. For more information, see File Security and Access Rights.

The DeleteFile function fails if an application attempts to delete a file that has other handles open for normal I/O or as a memory-mapped file (FILE_SHARE_DELETE must have been specified when other handles were opened).

The DeleteFile function marks a file for deletion on close. Therefore, the file deletion does not occur until the last handle to the file is closed. Subsequent calls to CreateFile to open the file fail with ERROR_ACCESS_DENIED.

Symbolic link behavior—

If the path points to a symbolic link, the symbolic link is deleted, not the target. To delete a target, you must call CreateFile and specify FILE_FLAG_DELETE_ON_CLOSE.

In WindowsВ 8 and Windows ServerВ 2012, this function is supported by the following technologies.

How to Recover Files from USB Flash Drive with or Without Software

When you delete files from USB, you have 4 ways to recover files from USB or pen drive. You can recover deleted files from USB with EaseUS data recovery software in simple clicks. Or you can also recover files from USB without software by using CMD or files backup.

Читайте также:  Windows 10 отключает планшет

Table of Contents

About the Author

Reviews and Awards

How to Recover Files from USB — Page Content

  1. 1. Recover deleted files from USB Using EaseUS data recovery software(Recommended)
  2. 2. Recover files from USB flash drive using CMD (Only recover hidden files)
  3. 3. Retrieve files from USB from previous versions (File backups required)
  4. 4. Restore USB files from Windows Backups (File backups required)

Several reasons can cause file loss on a USB flash drive or a pen drive, such as unintentional file deletion, hard drive formatting, storage device failure, and virus attack. Among them, accidental deletion is the most likely reason for data loss from USB.В

Where do deleted files from USB go?

Since the USB flash drive or pen drive is an external device, files deleted on the USB flash drive are deleted permanently instead of going to the recycle bin, so you cannot perform recycle bin recovery to recover files from USB. But you still have a chance to recover deleted files from USB by using the 4 ways in this tutorial.В

Note: When you realize that you have deleted files on USB by mistake, stop using your USB flash drive immediately to avoid data overwriting.В

How to Recover Files from USB Using Data Recovery Software

The most effective and possible way to recover deleted files from USB is to use professional data recovery software. EaseUS Data Recovery Wizard, a top-rank data recovery tool, can completely recover deleted files from UBS flash drive, pen drive, SD card, HDD, SSD, camcorder, digital camera, and so on.

Effective Data Recovery Software

  • Perform a deleted and formatted USB data recovery from different data loss situations.
  • Recover all types of lost files: photos, documents, videos, audio, emails, compressed files, etc.
  • Boot with a downloadable WinPE when your system fails to start or crashes.

Follow the steps below to recover deleted files from the pen drive/USB drive with a few clicks.В

Step 1.В Run USB data recovery software.

Connect the USB flash drive to your computer and launchВ EaseUS USB data recovery software on your PC. Select your USB drive which marks as a removable disk, and click «Scan» to start finding your lost files.

Step 2.В Scan all lost files from USB.

EaseUS Data Recovery Wizard will thoroughly scan your USB flash drive and find all your lost data on it. After the scanning process,В use the Filter feature to filter a specific file type. You can check and preview found USB files in this program.

Step 3.В Restore all lost files from USB.

A double-click will allow you to preview the file results. Choose the target files and click «Recover» to save them to aВ secure location on your PC or other external storage devices.

How to Recover Deleted Files from USB Flash Drive Without Software

For some users who don’t like to recover USB files with third-party software, you can try the three methods in this part to retrieve files from USB with CMD, Windows Backup, and previous versions.

However, these solutions have limitations and requirements. If you haven’t backed up your USB in advance, you can only use data recovery software to retrieve USB files.В

Recover Files from USB Using CMD (Only Recover Hidden Files)

Command Prompt is a Windows application available in all Windows Operating Systems. If your files are not deleted but missing from your USB flash drive or a pen drive, then you can follow this method to recover hidden files on USB with CMD.В

Steps recover deleted files from a USB flash drive using CMD:

Step 1. Connect the USB flash drive to your computer.

Step 2.В Click the Search button, type cmd.В Right-click Command Prompt and choose Run as administrator.В

Читайте также:  Aimp для windows android

Step 3. Run the following command lines in order.В

Type chkdsk X: /f in the Command Prompt window and hit Enter. Just make sure to replace «X» with the letter assigned to your USB flash drive.

Type attrib -h -r -s /s /d e:*.*В and hit Enter.В (e is the USB drive letter. You should replace g depending on your own USB drive letter shown on the computer)

Then, wait for the process to complete and close the window. Then you can check if your files are back.

Restore Deleted Files from USB from Previous Versions

In addition to recovering permanently deleted files from USB using software or CMD, you can try another option to restore an older version of files in Windows 10/8.1/8/7. Before you try this method, make sure that you have set up File History to automatically back up files. If you haven’t turned on this feature, give up this method, and use USB drive recovery software to make it.В

Step 1. Right-click on the folder that contains your deleted files on USB and select «Properties».

Step 2. Click on the tab «Previous Versions». You’ll be told there that previous versions come from File History or from restore points.

Step 3. A list of older versions of the file will be displayed. Choose the file edition you’re looking for, and click the «Restore» button to retrieve USB files.

Restore Deleted Files from USB withВ Windows Backups

If you have backed up data before, you can check the backups. Also, check the online or cloud storage service you use. It is possible you’ve synced your files to a cloud storage service such as Microsoft OneDrive, Dropbox, or Google Drive.В If you have turned on the Windows backup, you can retrieve USB data with it:

Step 1. Open «Control Panel», go to «System and Maintenance», select «Backup and Restore (Windows 7)».В

Step 2. Click «Restore my files».

Step 3. Click «Browse for files» or «Browse for folders» to select the previously created backup.

Step 4. Choose a location to save the backup — «In the original location» or «In the following location». If there’s a conflict, choose «Copy and Replace», «Don’t copy» or «Copy, but keep both files» according to your needs.

Step 5. Wait for the restoring process to complete. Then all of your files or folder that were permanently removed will show up on your PC at the original or the new location.В

Conclusion В

Deleting files on USB doesn’t mean permanent data loss. In this article, we’ve explained four methods to recover deleted files on pen drive with or without software. В EaseUS data recovery software offers the greatest chance to recover files from USB. It supports deleted file recovery, formatted recovery, raw drive recovery, and more data recovery features.В

How toВ Avoid USB Flash Drive/Pen Drive Data Loss

It is also of vital importance to protect your USB data in effective ways. If you don’t want to suffer from USB data loss, you can follow these tips to help:

Regularly Back Up Files

It’s a nice choice to back up files automatically with the help of file backup software. Here my suggestion is using EaseUS Todo Backup. With this software, even you don’t have the technical knowledge; you can still create an image. Follow the details below to back up data with the help of EaseUS backup and recovery software.

Step 1. Launch EaseUS Todo Backup software and then choose «File Backup», «Disk/partition Backup» or «System Backup» for different backup purpose.

Step 2. Choose the system, disk partition, files or apps that you want to back up. Then select a destination where you want to store the backup file.

Step 3. Click «Proceed» to start the data backup process.

Читайте также:  Directx для windows 10 x64 все версии

Plug and UnplugВ the USB Flash DriveВ Correctly

When you plugin or disconnect a USB to your computer or laptop, use it properly. When you disconnect it, use the «eject USB» option by right-clicking it.

Scan and Remove Virus on USBВ

Use anti-virus software to protect your computer against malicious computer viruses, trojan, and other malicious-ware. Be sure to update your Anti-virus software with the latest patch and signature files for maximum security.

Unlock and/or delete locked or protected files and folders for MS Windows OS.

A small and effective freeware program for unlocking and / or deleting locked or protected files!

Key Features in ThisIsMyFile

But beware! Wild deletion of files or folders is not recommended especially without the necessary knowledge.

Problem: «Xxxx.xxx Can not delete the file: The file is used by another person or program.»
OR: The action can’t be completed because the file is open in XXXXXX.exe 1.42 Close the file and try again.

Installation is not required, simply place the ThisIsMyFile on the desktop and drop files on the ThisIsMyFile program icon.

Have fun with deleting and unlocking!

Create a copy
If you want to copy the file before delete it.

.. only info
Shows who program that taken the file.

Unlock only
Only unlock the file not deleted

Reboot & Delete
For very stubborn candidates, activate this option.
The system will be shut down and the file and folders will be deleted at system startup.

Process killer
Can be found under «More ThisIsMyFile». This can be used to terminate or kill specific processes.

*Info
1.In some cases it is enough, to kill or to terminate the program that has several files and folders in use.

More ThisIsMyFile
Here you can see more details about the locked files.
The process killer can be used here, Selects the process or program and terminate it.

*Info
1. Automatically starts when deleting or unlock directories.
2. Use this in any case when it comes to the delete or unlocking of loaded modules (DLL-s).

Select files
Simply drag and drop the locked file to ThisIsMyFile and perform the desired action!

Program Parameters
For example: ThisIsMyFile.exe c:\file1.txt c:\file2.txt «c:\file with spaces.txt»
The Files with blank e.g. spaces, please always start with and end ‘»‘.

Supported Operating Systems

Unlock and, or deleting locked or protected files is supported on: Windows 10, Windows 10 Pro, Windows 10 Enterprise, Windows 10 Home, Windows 8.1, Windows 8.1 Enterprise and Pro, Windows 8, Windows 8 Enterprise and Pro, Windows 7, Windows 7 Enterprise, Windows 7 Home Basic, Windows 7 Home Premium + Professional, Windows 7 Starter + Ultimate, , X64, x86 and x32 all Windows, MS Windows Server 2019, 2016,2012, .

# ThisIsMyFile Versions History
New in version 3.66 // 6 February 2021
Small adjustments and update of the language files
New languages in the File-Unlocker for Windows OS: Norwegian

Many thanks to Norsk-Superman for the Norwegian language.

New in version 3.51 // 12 December 2020
Small corrections and improvements
Update of the language files
New languages in the files and folders unlock tool: Filipino, Malay, and Indonesian

Many thanks to A. Lincoln for the Filipino language.
Many thanks to Indonesian Super Girl for the Indonesian language.
Many thanks to Washington for the Malay language.

New in version 3.31 // 10 September 2020
Update due to false virus report on W10
Only for security reasons, although there was no virus.
New in version 3.22 // 29 August 2020
Small corrections and optimizations for all Windows 10 and MS servers
Important update of the language files
New languages in ThisIsMyFile: Hindi, Vietnamese and Thai

Thanks to The Hindi Man for the Hindi language
Thanks to Huy for the Vietnamese language
Thanks to Chanchana for the Thai language.

Оцените статью