Page 1 of 1

File path length?

Posted: Fri Mar 16, 2018 6:35 pm
by CrxtJ7tOs4Iq
I see there is a way to search based on name length(len:<length>), is there a way to do this on full path instead of just file name?
I am basically wanting a tool to find where the paths are to long for ntfs.

Re: File path length?

Posted: Fri Mar 16, 2018 7:35 pm
by NotNull
Nice idea!

Don't think that this is possible in Everything.
But if you combine the powers of Everything with those of Powershell, you have a workaround:
  • In Everything query what you want (for exampl, only Q:\data or exclude C:\Windows, ...)
  • Export these results as a txt file (example: AllFiles.txt
  • In Powershell, issue this command:

    Code: Select all

    gc .\AllFiles.txt | where -property length -gt 255 | Out-File .\TooLong.txt
    
In TooLong.txt are your long filenames (including path).


BTW: 255 isn't really too long. Ifyou address the fil in a Win32 way instead of the DOS-way:
\\?\C:\enormous\long\path\including\filename.txt can be addresseed this way.

PS: Not tested. Please report back if this works or not.

Re: File path length?

Posted: Fri Mar 16, 2018 9:24 pm
by CrxtJ7tOs4Iq
Awesome.... i already used powershell and everything command line for another project. Good thinking... will test early next week.
Will try my best to report back but i forget these things sometimes.

Re: File path length?

Posted: Fri Mar 16, 2018 10:58 pm
by therube
Adjust len: as needed.

Code: Select all

path:len:>254

Re: File path length?

Posted: Sat Mar 17, 2018 10:42 am
by NotNull
therube wrote:Adjust len: as needed.

Code: Select all

path:len:>254
Very nice!!


@CrxtJ7tOs4Iq:
Normally I do test such things before posting, but this time I was in a real hurry (after rereading: even more typo's than usual ..)
Of course you should go with @therube's solution, but if you need something similar for one of your projects: I've tested it and it works OK.
If you want output to file *and* screen (system looked dead for too long), use Tee -file .\TooLong.txt instead of Out-File .\TooLong.txt
You don't need the ES.exe command-line utility to export; that can be done in Everything itself through Menu:File > Export ..

Re: File path length?

Posted: Mon Mar 19, 2018 3:10 pm
by CrxtJ7tOs4Iq
Awesome!

Thanks

Re: File path length?

Posted: Tue Mar 20, 2018 3:16 pm
by CrxtJ7tOs4Iq
NotNull wrote: BTW: 255 isn't really too long. Ifyou address the fil in a Win32 way instead of the DOS-way:
\\?\C:\enormous\long\path\including\filename.txt can be addresseed this way.
Trying to use this example with anything Powershell. While it doesn't error. It doesn't seem to work.
Having a hard time finding additional information.

example get-acl '\\?\C:\enormous\long\path\including\filename.txt'

Re: File path length?

Posted: Tue Mar 20, 2018 4:06 pm
by NotNull
CrxtJ7tOs4Iq wrote:
NotNull wrote: BTW: 255 isn't really too long. Ifyou address the fil in a Win32 way instead of the DOS-way:
\\?\C:\enormous\long\path\including\filename.txt can be addresseed this way.
Trying to use this example with anything Powershell. While it doesn't error. It doesn't seem to work.
Having a hard time finding additional information.

example get-acl '\\?\C:\enormous\long\path\including\filename.txt'
I don't have enormous long paths, but this works for me:

Code: Select all

PS C:\temp> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.16299.248
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.16299.248
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\temp> get-acl '\\?\C:\Windows\System32\drivers\etc\hosts'


    Directory: \\?\C:\Windows\System32\drivers\etc


Path  Owner               Access
----  -----               ------
hosts NT AUTHORITY\SYSTEM NT AUTHORITY\SYSTEM Allow  FullControl...

PS C:\temp> copy  '\\?\C:\Windows\System32\drivers\etc\hosts' .
PS C:\temp> ls hosts


    Directory: C:\temp


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        16-7-2016     13:45            824 hosts

PS C:\temp>
No idea why it dowsn't work in your case ...

Re: File path length?

Posted: Tue Mar 20, 2018 5:21 pm
by CrxtJ7tOs4Iq
NotNull wrote:
CrxtJ7tOs4Iq wrote:
NotNull wrote: PS C:\temp> $PSVersionTable
No idea why it dowsn't work in your case ...
good call on the PS version.
I was using 3... appears to work when tested on 5.

Thanks!

Re: File path length?

Posted: Tue Mar 20, 2018 6:34 pm
by NotNull
CrxtJ7tOs4Iq wrote: good call on the PS version.
I was using 3... appears to work when tested on 5.

Thanks!
You're welcome! Luckily it was the vrsion; otherwise I had no clue ..
Thanks for feedback!

BTW: did you bas64 encode your username? (m'N*)

Re: File path length?

Posted: Tue Mar 20, 2018 6:37 pm
by CrxtJ7tOs4Iq
NotNull wrote:
CrxtJ7tOs4Iq wrote: BTW: did you bas64 encode your username? (m'N*)
Heh.... no....
it was just randomly generated.

Re: File path length?

Posted: Tue Mar 20, 2018 6:42 pm
by NotNull
CrxtJ7tOs4Iq wrote: Heh.... no....
it was just randomly generated.
Nice coincidence...
Think I'll try this as a "password generator" ... password "Pasword" > base64 encoded: "UGFzc3dvcmQ=".
Easy to remember, hard to crack (well, until now, that is :D )

Good luck with your long file paths!

Re: File path length?

Posted: Tue Mar 20, 2018 8:48 pm
by CrxtJ7tOs4Iq
NotNull wrote: Good luck with your long file paths!
man that \\?\ trick is sweet! makes me not really care.

Will rewrite my powershell script that is auditing permissions and all will be good.

Thanks again