How to Unlock a File Before Renaming?

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:

  1. Click the upward icon in the notification area of your Taskbar.
  2. Right-click a program minimized to the system tray and select the Exit/ Quit option.
  3. Click Yes if you’re prompted to confirm the action.

Terminate background processes:

  1. Press Ctrl + Alt + Delete keys simultaneously and open Task Manager from the new screen. Alternatively, right-click on your Taskbar and select the Task Manager option from the list.
  2. Click on More details to expand the user interface.
  3. Look for the processes in the Processes tab using your file. Right-click a process you want to terminate, and select the End task option.
  4. Similarly, click on the Details tab. Look for the background tasks that may be using your file. Right-click a task and select the End task option.

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:

  1. Visit the Microsoft Download Center to download Process Explorer.
  2. Open the Process Explorer with elevated permissions. To do so, just right-click it and select the Run as Administrator option.
  3. Click the Gunsight icon on the toolbar.
  4. Drag it using your mouse onto the locked file.
  5. Process Explorer will highlight the corresponding program using your file.

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:

  1. Right-click the file for which you want to change the permissions.
  2. Select Properties.
  3. Click on the Security tab and select Advanced.
  4. Click on the Permissions tab.
  5. Double-click the currently logged in user from the list.
  6. Check-up the Full control box and then close the window.
  7. Click OK twice.

Steps for changing permissions for files stored on Network Drives:

  1. Right-click your file and select Properties.
  2. Click on the Security tab and check whether your logged in account is already added.
  3. If not, click on the Add button.
  4. In the Enter the object names to select textbox, enter your username. You can enter multiple usernames by separating them with a semicolon (;).
  5. Click on Check Names.
  6. In the Permissions list, provide the Full Control privileges.
  7. Click on OK to save your settings and exit.

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:

Syntax:

net use u: “\\YourNetowrkDriveLetter\YourFolderName” persistent=yes 

Example:

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:

  1. Type Command Prompt.
  2. Right-click it in the search results and select Run as Administrator.
  3. Type the following command and press Enter:
    • net config server /autodisconnect:-1

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.




Leave a Reply

Your email address will not be published.


Comment


Name

Email

Url