0

When I am trying to move a lot of files from one folder to another folder windows shows me a message about one of those files:

  The file name(s) would be too long for the destination folder. You can
  shorten the file name and try again, or try a location that has a shorter 
  path.    
         f123456789012345
         Item type: AVI File 
         Size: 115 MB  
         Availability: Available offline      

It means that windows responds some kind of events and it shows me a message with a few information about that file which failed to move from one folder to another.

But I need to how handle that kind of event using .NET?
I need to write all information about that kind of files to display, I mean to TextBox....

How can I solve this problem?
Should I use any external libraries like "Windows API Code Pack"?

  • You handle this the *exact* same way as "File not found" or "Path not found" or "Sharing violation" or "Disk full" or "Access denied" or "Network not found" or the gazillion other ways you can't do what you hoped to do. The file system is out of your control, all you can do is tell the user what went wrong and he'll need to fix the problem. That's never a problem. All you can possibly do wrong is not give the user good information. Or think that you can fix the problem yourself. – Hans Passant Oct 22 '15 at 22:04
  • Thanks! If you are talking truth then this Idea can help us..... – IremadzeArchil19910311 Oct 23 '15 at 14:03

1 Answers1

0

According to MSDN, the maximum length for a path is MAX_PATH, which is defined as 260 characters. The Windows API has many functions that also have Unicode versions to permit an extended-length path for a maximum total path length of 32,767 characters.

Make sure that your destination path doesn't enlarge the file path length too much that it causes a failure.

Mark Segal
  • 5,427
  • 4
  • 31
  • 69