10 hours ago10 hr What Apis can be used for deleting a file or a folder?Can someone list most of them or all of them?
7 hours ago7 hr DeleteFileDeleteFileA: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefileaDeleteFileW: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-deletefilewRemoveDirectoryRemoveDirectoryA: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectoryaRemoveDirectoryW: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-removedirectorywSHFileOperationSHFileOperationA: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationaSHFileOperationW: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shfileoperationwSHFILEOPSTRUCT (for SHFileOperation)SHFILEOPSTRUCTA: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileopstructaSHFILEOPSTRUCTW: https://learn.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-shfileopstructw
4 hours ago4 hr Some have already been included from @fearless API/LibraryFunction/MethodLanguage/FrameworkNotesWindows API (Native)DeleteFileA() / DeleteFileW()C/C++Low-level, Unicode support with W variant. Only deletes files, not directories.Windows API (Native)RemoveDirectoryA() / RemoveDirectoryW()C/C++Deletes empty directories only. Must be empty first.Windows API (Native)SHFileOperationA() / SHFileOperationW()C/C++High-level Shell API. Can delete files/folders recursively with flags like FO_DELETE. Supports recycle bin.Windows API (Native)IFileOperation COM InterfaceC/C++Modern replacement for SHFileOperation(). Better for recursive deletion and recycle bin support.MSVC Standard Librarystd::filesystem::remove()C++17+Deletes a single file or empty directory.MSVC Standard Librarystd::filesystem::remove_all()C++17+Recursively deletes files and directories.Qt FrameworkQFile::remove()C++ (Qt)Deletes a single file. Cross-platform.Qt FrameworkQDir::removeRecursively()C++ (Qt)Recursively removes a directory and all contents. Cross-platform.Qt FrameworkQDir::rmdir()C++ (Qt)Removes an empty directory only..NET FrameworkFile.Delete()C# / VB.NETDeletes a single file..NET FrameworkDirectory.Delete()C# / VB.NETDeletes a directory; optional recursive parameter for contents.Python (stdlib)os.remove()PythonDeletes a single file.Python (stdlib)os.rmdir()PythonRemoves an empty directory.Python (stdlib)shutil.rmtree()PythonRecursively removes a directory tree.
Create an account or sign in to comment