Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
http 、 ftp 、またはローカルパスのいずれかを入力するメソッドがあります。入力 URL を使用して、それがファイルかディレクトリかを判断する必要があります。
Path.GetExtension(url) はほぼ問題なく動作します。しかし、ディレクトリが /have '.' で始まる場合 であると、このチェックは失敗します。
ディレクトリの場合、URLを確認して一覧表示する他の方法はありますか?
あなたは使用することができFile.Exists(url)ますDirectory.Exists(url)
File.Exists(url)
Directory.Exists(url)
もう 1 つの方法は、拡張機能の配列を作成し、Path.GetExtension(url)それに対して結果をチェックすることです。
Path.GetExtension(url)