Skip to content

Conversation

@workbysaran
Copy link
Contributor

@workbysaran workbysaran commented Nov 7, 2025

Resolved / Related Issues
Enhance the delete operation to show which specific file is locked and which application is using it when attempting to delete a folder containing locked files.

Closes #9444

Steps used to test these changes

  1. Single file deletion

    • Open a file in Microsoft Word
    • Try to delete the file
    • Verify error shows: "The file you are attempting to access is currently being used by Microsoft Word (PID: XXXXX)"
  2. Folder deletion with locked file

    • Create a folder with multiple sub folders & files
    • Open one file inside the folder with Microsoft Word
    • Try to delete the entire folder
    • Verify error now shows: "The file you are attempting to access is currently being used by Microsoft Word (PID: XXXXX)"
    • Verify the specific locked file path is displayed

…howed a generic error message "The file you are attempting to access is currently being used by another application" instead of identifying the specific file and process.
@workbysaran workbysaran changed the title Fix: Fixed an issue where deleting a folder containing locked files s… Feature: Show specific locked file and process when deleting folders Nov 7, 2025
@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Nov 7, 2025
@yaira2 yaira2 requested a review from Copilot November 9, 2025 03:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the file-in-use detection for delete operations by recursively checking files within directories. When a directory deletion fails due to files being in use, the code now enumerates all files within that directory to identify which specific files are locked, rather than just reporting the directory itself.

  • Introduces recursive file enumeration for directories that fail to delete due to "InUse" status
  • Maintains backward compatibility by falling back to original behavior if no files are found
  • Adds error handling for directory enumeration failures
Comments suppressed due to low confidence (2)

src/Files.App/Utils/Storage/Operations/ShellFilesystemOperations.cs:429

  • Poor error handling: empty catch block.
							catch { }

src/Files.App/Utils/Storage/Operations/ShellFilesystemOperations.cs:429

  • Generic catch clause.
							catch { }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yaira2 yaira2 changed the title Feature: Show specific locked file and process when deleting folders Fix: Fixed issue where process details weren't displayed when deleting folders with open files Nov 9, 2025
@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed ready for review Pull requests that are ready for review labels Nov 9, 2025
@yaira2 yaira2 merged commit d10a581 into files-community:main Nov 9, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Featuer: Add a "library in use" dialog when trying to delete

2 participants