c# - Possible to specify directory path with a wildcard? -


मेरे पास निम्न कोड का कोड है:

  foreach (Directory.GetFiles में स्ट्रिंग फ़ाइल) (SourcePath)) {// जो कुछ भी}   

यह एक विशिष्ट निर्देशिका से फाइल हो जाता है क्या वाइल्डकार्ड का उपयोग करके निर्देशिकाओं का मिलान करना संभव होगा? उदाहरण के लिए:

  c: \ test \ di *   

सभी फाइलों को डायरेक्टरी में मिलती है:

  c : \ Test \ dictionary \ c: \ test \ directory \ c: \ test \ dig \   

मैंने देखा है कि आप GetFiles विधि में एक फ़ाइल फ़िल्टर पास कर सकते हैं, लेकिन यह फाइलों पर लागू होता है केवल, निर्देशिका नाम नहीं।

आप इसके लिए एक है जो आपको एक खोज पैटर्न निर्दिष्ट करने की अनुमति देता है या आपको खोज विकल्प निर्दिष्ट करने की आवश्यकता है:

  foreach (Directory.GetDirectories (sourcePath, "di *") में स्ट्रिंग निर्देशिका) {// whatever}    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Confused over DLL entry points (entry point not found exception) -

c# - Using Vici cool Storage with monodroid -