[Alphaleonis.Win32.Filesystem.File]::GetFileSystemEntryInfo($File).filesize

Jul 5, 2013 at 2:34 PM
I noticed that i am getting
"Exception calling "GetFileSystemEntryInfo" with "1" argument(s): "Directory not
found:E:\Path\file.ext"
On files with a path longer then 260 characters.
Is there something i can do to fix this?
Developer
Jul 5, 2013 at 4:15 PM
Hi,

Do you get this exception with the current 1.5 release or with the latest Development build?

Regards,
Yomodo
Jul 5, 2013 at 4:17 PM
I am using the 1.5 stable
Developer
Jul 5, 2013 at 4:21 PM
Ah, then please try the latest Development build since this has many bugfixes and improvements.

Yomodo
Jul 5, 2013 at 4:22 PM
Am i blind i only see the 1.5 to download.
Developer
Jul 5, 2013 at 4:25 PM
Jul 5, 2013 at 4:28 PM
Does that mean i have to compile it myself? Or am i really really blind :P
Developer
Jul 5, 2013 at 4:37 PM
Yes, these are only the sources.

But adding AlphaFS to your current solution and compile should be do-able, right?
Jul 5, 2013 at 5:27 PM
I actually dont have a way to compile it.
I am just using powershell and running import-module .\AlphaFS.dll
Developer
Jul 5, 2013 at 5:56 PM
Justusiv,

I've compiled it for you.

You can get it here: https://alphafs.codeplex.com/SourceControl/list/patches
Jul 5, 2013 at 6:01 PM
Hey that fixed it i think :)
Thank you!
Jul 5, 2013 at 8:00 PM
Edited Jul 5, 2013 at 8:28 PM
Hmmmmm
While there isnt any errors thrown i am still having some files MIA
Can you see any flaw in code?

Windows is reporting 204,672 files
my powershell script is reporting 204,643 files
function get-allfiles($path){
    if($path -ne $null -or $path -ne ""){
        [Alphaleonis.Win32.Filesystem.Directory]::GetFiles($Path)
        $directory = [Alphaleonis.Win32.Filesystem.Directory]::GetDirectories($Path)
        $directory | %{get-allfiles $_ }
    }
}

#Count Files
$totalfiles = 0
$path = "d:\Dir1\Dir2\Dir3"
$files = get-allfiles $path
foreach ($file in $files){$totalfiles ++}
$totalfiles
EDIT
Just noticing that it appears to work on any folder without the max path issue but does break on folders with the max path.
Developer
Jul 9, 2013 at 10:02 AM
Justusiv,

Are you absolutely sure that PATH TOO LONG/MAX PATH is the issue here?
Internally AlphaFS will always use the Unicode version of the Win32 API's, supporting long paths.

Do you explicitly get a Path too long exception?

How about the environment in which the PowerShell script is running?
Have you tried running it with elevated rights?

One PowerShell error I eventually get is this, probably to prevent a stackoverflow because of recursion.
The script failed due to call depth overflow.  The call depth reached 1011 and the maximum is 1010.
Furthermore, The Directory() class has two (overloaded) methods: Directory.CountDirectories() and Directory.CountFiles()
Perhaps these will work for you.

Regards,
Yomodo
Jul 9, 2013 at 3:06 PM
Thank you for your time.
I was compairing my script to the windows GUI it turns out my script and your dll is correct and the windows GUI is wrong.
Things are working perfectly...
Thank you again!
Marked as answer by Yomodo on 1/14/2014 at 7:35 PM
Jul 16, 2014 at 2:17 PM
I am also trying to use AlphaFS via Powershell with import-module to solve a problem handling long paths.
Like JUSTUSIV, I also do not have the ability to compile the sources.
I looked at https://alphafs.codeplex.com/SourceControl/list/patches but the Jul 5, 2013 upload mentioned here now shows as "denied" with no download link. Is there still a complied DLL available to use AlphaFS for long paths in Powershell?
Thanks
Developer
Jul 16, 2014 at 7:10 PM
Hi, unfortunatey no, install/use Visual Studio Express to compile to a .dll
Jul 16, 2014 at 9:05 PM
Ok, did that. The stable release had method named GetFullFileSystemEntries. The dev alphafs-109740 does not.
Tried searching for doc for the dev release, but could not find any.
Inside the loop I needed to look at properties for: isdirectory, lastaccessed, and filesize.
Which method can I now get those properties with?

PS R:\ps1> [Alphaleonis.Win32.Filesystem.Directory]::GetFullFileSystemEntries($uncPath, ".", $recurse)
Method invocation failed because [Alphaleonis.Win32.Filesystem.Directory] does not contain a method named 'GetFullFileSystemEntries'.
At line:1 char:1
  • [Alphaleonis.Win32.Filesystem.Directory]::GetFullFileSystemEntries($uncPath,
    "*. ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : MethodNotFound
Developer
Jul 17, 2014 at 12:41 PM
The method you're looking for is the .NET 4 equivalent:
Directory.EnumerateFileSystemInfos()
Check the SystemInfo property from the returned object to find (amongst others) the IsDirectory property.
Jul 21, 2014 at 6:03 PM
I still have the dll provided to me from way back when.
I would be happy to send it to you.
Is there any reason why you guys wont compile that for him?
Developer
Oct 10, 2014 at 8:14 PM
Because on every update of AlphaFS.dll, I have to recompile and sent it to people.

It is easier to install Visual Studio 2013 Express so one can compile AlphaFS, always.