Windows cannot delete some files with spaces, especially if the space is at the end of the file name. The delete command trims the spaces from the name and then simply cannot find such file. Old fashion DEL command like this
DEL /F “F:\Folder1\Folder2\File Name “
still may not work.
In order to resolve the issue, first identify old-fashioned 8.3 file name
DIR /A /X “F:\Folder1\Folder2”
Now, when you see the file name, simply use it in the following command
DEL /F “\\?\F:\Folder1\Folder2\File Name *”
Another way to do it is to use file sharing. Some files can be deleted from remote computer, if the file is located within the shared folder.
Third way can be to use the remote system that understands non-Windows special characters, for example LINUX or MAC computer. Share the Folder2 folder as SharedFolder with Everyone FullControl
On the remote LINUX machine mount this folder
apt-get install cifs-utils
mount -t cifs //ServerName/SharedFolder /mnt/SharedFolder
Delete the file
rm -f –no-preserver-root /mnt/SharedFolder/File Name
Unmount the shared file system