Files can get locked for a variety of reasons. Here are some possible reasons why you’re unable to rename a file:
Solution 1: End the Corresponding Process
Exit all the programs on your screen and try renaming the file. If the problem continues to persist, open Task Manager and look for the corresponding program/ process using your file.
Exit system tray icons:
Terminate background processes:
Solution 2: Restart your Computer
Sometimes, simply restarting your machine may also help. You’ll be able to rename your file without file locked error after restarting your computer.
Solution 3: Identify which Process is Using your File
Microsoft’s Sysinternals tool includes a Process Explorer that helps you identify the program or process using your file. This tool is free-of-cost and can be downloaded from Microsoft’s official website. Here’s how:
Solution 4: Resolve File Access Permissions
Make sure that you have the required privileges to access and rename the file. You can change the file permissions using the File Properties dialog box.
Steps for files stored on your local computer:
Steps for changing permissions for files stored on Network Drives:
Solution 5: Fix Network Disconnectivity
If your network drive gets disconnected intermittently, check if there are any Internet network connectivity issues.
You may also want to try setting up your connection to persistent attribute in your script:
net use u: “\\YourNetowrkDriveLetter\YourFolderName” persistent=yes
net use u: “\\G:\Documents” persistent=yes
If the problem continues to persist, disable the AutoDisconnect feature. While using shared network drives, Windows automatically disconnects the drive after a regular interval of inactivity. You may either change this default time or completely disable this feature using Command Prompt:
Note: The disconnection interval is in minutes. Type -1 to completely disable auto disconnecting. Or use any number upto 65,535 to specify a custom disconnection interval in Minutes. For example, you may want to type “net config server /autodisconnect:60” (without quotes) to auto disconnect after 60 minutes.
Renaming the Unlocked Files
After unlocking your files, it’s time to rename them all at once. If you’ve hundreds of files to rename, a specialized software Easy File Renamer can come to your aid.
Easy File Renamer allows you to add files from multiple sub-folders and rename them at once. It comes with plenty of file renaming rules that are useful to rename the files the way you want. For instance, you may add new text, replace or remove text, change text case, swap characters, and do much more. Moreover, EFR has a simple and intuitive interface.