How to Delete a File When the Filename Is Too Long

By Kirk Bennet

If you use your business computers to store and organize all your business data, you occasionally run into files that have a name that's too long for Windows 7. Windows 7 can handle names of up to 260 characters in length, but the entire path to the file is also included in this limit. If you attempt to delete the file, you will receive the "Error: File name too long" message. You receive this error because Windows attempts to move the file to the Recycle Bin. To solve this issue, you must prevent Windows from moving the file to the Recycle Bin folder. If this doesn't work, you can use the Command Prompt utility to delete the file.

Disable Recycle Bin

Right-click the Windows taskbar and select "Show the desktop" from the context menu to get to the desktop.

Right-click the "Recycle Bin" folder and select "Properties" from the context menu to open the Recycle Bin Properties window.

Select each drive and click the "Don't move files to the Recycle Bin..." radio button.

Click "Apply" and then "OK" to apply the new settings and close the Properties window.

Select the file with the long filename, press "Delete" and click "Yes" when asked if you want to permanently delete the file.

Open the "Recycle Bin Properties" window again, select each drive and click the "Custom size" radio button. Click "Apply" and then "OK" to re-enable the Recycle Bin with the default settings.

Using the Command Prompt

Click Start and select "Computer" from the menu to open Windows Explorer.

Navigate to the folder that contains your file, press "Shift," right-click an empty spot in the right pane and choose "Open command window here" from the context menu to launch the Command Prompt utility.

Type "dir /x" and press "Enter" to run the command and list all files in the folder, along with their short names. The short name assigned by Windows 7 to your file is displayed between its size and long name columns.

Type "del short_name" (replacing "short_name" with the short name of the file to be deleted) and press "Enter" to delete the file.


Alternatively, in Windows Explorer, you can select the file, hold "Shift" and press "Delete" to delete it permanently, even if you use the Recycle Bin.


Permanently deleted files cannot be recovered.