Use this when file copy, move or delete operations fail.
File Operations Troubleshooting
Troubleshoot file operations by checking permissions and ownership, files locked by another process (Resource Monitor, handle.exe), path length, read-only or system attributes, free space and antivirus blocking.
1. Exact error (Access denied, in use, path too long, not found).
2. Access denied → Get-Acl, ownership.
3. In use → handle.exe <file> / Resource Monitor.
4. Path too long → long paths / robocopy.
5. Network path → connectivity and share permissions.
operation → path resolution → lock check → ACL check → result
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Known-good, broken and when it is fixed Verify boundary
Known-good means the same identity can read the source, create/replace the destination and read back expected size/hash/metadata without new filesystem or storage errors. Broken evidence is a reproducible authorization, lock, path or I/O failure tied to one boundary. A successful small test file shows only that operation/path; the limit of what it shows for the incident is the original file set and destination under the original identity, with integrity read-back where data correctness matters.
Step 2 Common mistakes Narrow the fault
- Copying with Explorer instead of
robocopyfor large or ACL-sensitive copies.
Step 3 Native failure isolation and next-check logic Narrow the fault
Test source read and destination create separately using the same user context. For Access Denied, inspect effective ACL/share rights and ownership rather than taking ownership immediately; for sharing violations, identify the open handle/process; for path/name problems, test the exact API/path form; for I/O errors or stalls, correlate filesystem/storage events and another file on the same volume. If local copy works but SMB copy fails, branch to SMB/share/network rather than filesystem repair.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- 'Access denied' is often ownership or broken inheritance.
- 'File in use' means another process holds a handle.
- Path length over 260 characters breaks some tools.
Get-ChildItem <path> -Force— contents including hiddenTest-Path <path>— exists?Resolve-Path <path>— full pathGet-Item <path> | fl *— attributes and timestamps
ReferenceHow it works1 section · depth on demand
How it works
Windows file operations are mediated by path resolution, share/NTFS authorization, filesystem metadata, open handles/locks, filter drivers and underlying storage completion. A copy may fail because the source cannot be read, destination cannot be created, a file is in use, a path exceeds application limits, security blocks the operation or the volume cannot commit data. Explorer messages often collapse these boundaries, so preserve the exact source/destination, identity and Win32/PowerShell error.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Copy with logging you can trust
robocopy D:\Data \\fs02\Data /MIR /COPY:DAT /DCOPY:DAT /R:2 /W:5 /MT:16 /XJ /NP /LOG:C:\Temp\copy.log /TEE
echo %ERRORLEVEL%
| Option | Effect |
|---|---|
/MIR | Mirror — deletes files at the destination that are not in the source |
/COPY:DATSOU | Data, attributes, timestamps, security (ACLs), owner, auditing |
/R:2 /W:5 | 2 retries, 5 s wait (default is 1 million retries × 30 s) |
/MT:16 | 16 threads |
/XJ | Skip junctions (avoids loops in profile folders) |
/B or /ZB | Backup mode — copy files despite ACLs (needs backup privilege) |
/L | List only — dry run |
Exit codes
The robocopy reference documents its exit codes and states that any value of 8 or more means at least one failure. Practical summary:
| Code | Meaning |
|---|---|
| 0 | Nothing copied, no failure |
| 1 | Files copied successfully |
| 2 | Extra files at destination |
| 3 | Copied + extra files |
| 5 / 6 / 7 | Combinations including mismatched files |
| ≥ 8 | At least one file failed |
Scripts that treat any non-zero exit as failure break on robocopy; test %ERRORLEVEL% GEQ 8.
Common file-operation errors
| Error | Cause | Fix |
|---|---|---|
| Access denied | ACL, file owned by another user, or EFS | Backup mode /B, take ownership deliberately |
| The process cannot access the file because it is being used | Open handle | Get-SmbOpenFile on servers, Resource Monitor / handle.exe locally |
| Path too long | > 260 characters for apps without long-path support | Robocopy handles long paths; enable LongPathsEnabled for supporting apps |
| File name invalid | Trailing spaces/dots, reserved names (CON, NUL) | Rename via \\?\ prefix paths |
| Disk full at destination | Space, quotas (FSRM) | Check quota and free space |
Verify the copy
Compare counts and sizes from the log summary; for critical data, compare hashes (Get-FileHash) on a sample.
Method
File operation troubleshooting covers copy, move and delete failures: access denied, file in use, path too long, or slow transfers.
| Error | Cause | Fix |
|---|---|---|
| Access denied | Permissions, ownership, UAC | Check ACL; take ownership carefully (takeown, icacls) |
| File in use | Open handle | Find with Resource Monitor or handle.exe; close the application |
| Path too long | > 260 characters | Enable long paths (policy), use \\?\ prefix or robocopy |
| Disk full / quota | Free space, user quota | Get-Volume, FSRM quotas |
| Slow copies | Antivirus, small files, network | robocopy with /MT, exclusions where appropriate |
icacls "D:\Data\file.txt"
handle64.exe -a budget.xlsx
robocopy D:\Src E:\Dst /E /COPY:DAT /R:2 /W:5 /MT:16 /LOG:C:\Temp\copy.log
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Files & Directories → File Operations Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/windows-server/storage/file-server/ntfs-overview · confidence 94%