Monday 18 May 2015

How to delete a file in Windows with a long filename

Windows has a restriction on length of the filename. But sometimes, you may end-up with files which are having larger than 250 characters and windows will not allow us to delete them. 
Windows 7 has come up with a tool called robocopy. We can delete long named files with the help of this tool. 

Robocopy has an option called mirror copy which will create a mirror of source in destination folder. 
  • Create an empty folder. 
  • robocopy empty_folder long_named_directory /s /mir
  • Now it will create mirror of empty folder in destination folder leaving bot the folders empty. 
  • You can happily delete both of them.