Move File or Copy File:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Directory.GetFiles(“yourdirpath”).[Select](Function(f) New FileInfo(f)).Where(Function(f) f.CreationTime = DateTime.Now AndAlso f.Extension.Equals(".pdf") ).ToList()
Sub FSOMoveAllFiles ()
Dim FSO As New FileSystemObject
Dim FromPath As String
Dim ToPath As String
Dim FileInFromFolder As Object
FromPath = “A1”
ToPath = “A2”
Set FSO = CreateObject(“Scripting.FileSystemObject”)
For Each FileInFromFolder In FSO.GetFolder(FromPath).Files FileInFromFolder.Move ToPath Next FileInFromFolder
@mukeshkala @Vibhor.Shrivastava @Vrinda_Jain @nisargkadam23 @Lahiru.Fernando @seanrockvz13 @StefanSchnell
As the error states It’s the issue with the FileName / the Path or the both are very long which is not in the permitted
As this exception is from Windows, So try to reduce your path or FileName will solve your issue
Hope this may help you
There is also a way for you to edit windows registry settings to allow file paths that go beyond 256 characters. I remember we ran into this issue in one of the projects, and we changed this setting to fix it.
As @Lahiru.Fernando suggested, if all approaches fail then the last option will be to fix this by editing registry setting.
There is another option as well. Refer the solution from @otico in this thread (Option 2).