Short path name on network paths fails
See original GitHub issueI have been able to create files on a network path (ex: \\my.net.foo\some\long\path\bar.txt
) but then I encounter 2 problems:
- I can’t do anything with the file because obviously Explorer can’t support it for some reason. So how would I proceed to delete the file?
- When I try to get a short path name on what it seems to be any network path, even if part of it is mapped to a drive (ex:
Z:\long\path\bar.txt
, whereZ:
is\\my.net.foo\some
), the returned path is always longer than the original path.
Some additionnal info:
- Windows 8 (On my laptop)
- Works on paths that aren’t network ones. I can get short path name for long paths on my desktop for example (
C:\
)
I’m thinking it may have to do with the protocol used for the network file system as described here but other than that I’m clueless. If that truly is the problem (I don’t have the info concerning what technology is used yet) then there’s not much I can do.
Am I on the right track or am I missing something?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How can I find the short path of a Windows directory/file?
I found very handy way to solve short pathname of current directory ... Right-click in the destination folder => Path Copy => Short...
Read more >How to Fix the "Network Path Was Not Found" Error on ...
1. Double-Check the Path Names ; Right-click on the targeted drive and choose Properties from the context menu. Drive properties in File Explorer....
Read more >c# - FileInfo Fails on *Short* Path Name
I was having problems with long paths, so I made calls to (Win32) GetShortPathNameW, which returns a very nicely sculpted short name like:...
Read more >Working Around Filepath Too Long Error in File Explorer
Solution: It's a Windows Explorer limitation. Windows itself is capable of paths somewhere around 32000 characters.
Read more >Network Path No Longer working
I have found that Network Paths (short version) are no longer working. I have a local path to my nas device and can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fair enough ! I personally do not need the help anymore and it doesn’t seem to be a common problem.
Have a nice day. Mat
A MVCE is a little bit hard to provide since the problem appears only on shared file systems. That being said, I had done some research and I was told that the protocol that the company used did not support short paths.
(I dont have the exact code nearby) Basically, all I was trying to do was to create a new ZlpFileInfo(“\woah.this.path\is\loooong…”) and then open a stream to it so that it would be created on the FS. It did work kinda, as in it created the file on the shared FS, but the short name version of the file would simply not be shorter than its normal name. That’s where he protocol thing comes into play I’m fairly sure…
On another note, I notoced that if I create a file on my desktop (not related to shared FS), like “C:/desktop/teeeeeeeeeee…xt.txt” using Zlp (because windows wouldnt let me obviously), then I cant do anything with the file manually. It becomes impossible to open it, delete it, rename it, etc. because windows complains that the filename is too long. Is there a way to avoid such a thing ?
Thank you for your time. Mat