alphaleonis / AlphaFS

AlphaFS is a .NET library providing more complete Win32 file system functionality to the .NET platform than the standard System.IO classes.
http://alphafs.alphaleonis.com/
MIT License
562 stars 99 forks source link

File move operation failed to work on path length over (approx) 280 characters #446

Closed danielkcng closed 6 years ago

danielkcng commented 6 years ago

Using Powershell command [Alphaleonis.Win32.Filesystem.File]::Move($sourceFilePath, $destFilePath)

gives: Exception calling "Move" with "2" argument(s): "(3) The system cannot find the path specified: [\?\$sourceFilePath]"

  1. $sourceFilePath is a short path, and the file does exist
  2. If the $destFilePath is somehow longer than around 280 characters, I got the error. Shorter length, such as 275 does work (even it's longer than the 260 Win32 API limit)
Yomodo commented 6 years ago

Just checking, you are using AlphaFS 2.2.1?

danielkcng commented 6 years ago

Yes, I tried both 2.2.0 and 2.2.1, same result.

BTW, if the SourceFilePath is long, the Move also failed.

Yomodo commented 6 years ago

Are $sourceFilePath and $destFilePath relative or absolute paths? (Could you post the paths.)

If I look at the error, it seems that $sourceFilePath is passed literally, not its value.

danielkcng commented 6 years ago

Oh sorry, I must be in bad condition today, I typed the paths incorrectly ☹, causing the errors, despite checking them visually before I posted the issue.

Yomodo commented 6 years ago

We've all been there. 😄