Windows uses the Win32 namespace to determine the validity of file and folder names. One of the rules, according to the namespace, is that the names cannot contain a trailing space or period (dot). So something like“file.txt.”or“file.txt ”(notice the space at the end) would not be valid.

However, there are situations where you may create or have such files or folders. Whenever you try deleting, renaming, moving, or copying such a file or folder, Windows will treat it as if its trailing space or period is not there. So it’ll search for some other item instead.

In such cases, you’ll get an error message that says “Item Not Found. Could not find this item. This is no longer located in …” To resolve this issue, you need to use some means that do not depend on the Win32 namespace, which we have explained below.

del-long-device-path-command-prompt

Delete or Rename Through Command Prompt Using Long Device Path

The easiest way to solve this issue is by using the long device path of the file/folder according to the Universal Naming Convention while deleting the file. This path uses the\?\syntax before the absolute path.

Each file or folder contains a path that helps determine the exact location of the file/folder. For instance, The folderSystem32inside theWindowsdirectory of theC drivehas an absolute pathC:\Windows\System32. And its long device path is actually\?\C:\Windows\System32

This type of path ignores any invalid characters in the path name, so you may safely use it to delete or rename the file showing the above error. You will have to use command-line interfaces like the Command Prompt and utilize the long device path with the respective commands for this purpose.

rd-rmdir-long-file-path-trailing-space

Mirror an Empty Folder Using Robocopy

It is also possible to resolve this issue byforcefully deleting the error fileor folder in the following way:

you may use therobocopycommand with the/miroption to mirror the empty folder.

However, remember that you may only delete the folder or file using this method. If you need to rename it (or move/copy), it’s best to utilize the above method instead.

rename-file-long-device-path-command-prompt-trailing-space

create-new-folder-move-from-folder-with-trailing-space-delete-old-folder-long-device-path-command-prompt

robocopy-mirror-empty-folder-to-parent-folder-of-files-and-folder-with-trailing-zero-name