मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग7.8k · #13060

list-and-count-directories

यह क्या करती है

यह स्किल AI एजेंट को किसी डायरेक्टरी के भीतर केवल फ़ोल्डर सूचीबद्ध करने और उनकी गिनती करने का तरीका बताती है। यह उन लोगों के लिए है जिन्हें किसी प्रोजेक्ट के मॉड्यूल, स्किल या रिपॉज़िटरी की सूची चाहिए।

कब इस्तेमाल करें

  • ✓जब आप किसी प्रोजेक्ट या स्किल्स डायरेक्टरी के भीतर फ़ोल्डरों की गिनती चाहते हों।
  • ✓जब दस्तावेज़ या समीक्षा के लिए सब-फ़ोल्डरों की क्रमांकित सूची चाहिए।
  • ✓जब आप किसी रिपॉज़िटरी को देख रहे हों और उसकी संरचना का त्वरित सार चाहते हों।

Skill का लिंक

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/list-and-count-directories/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/list-and-count-directories/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरी स्किल्स डायरेक्टरी के सभी फ़ोल्डर सूचीबद्ध कीजिए, छिपे हुए छोड़ दीजिए, और बताइए कि कुल कितने हैं।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट डायरेक्टरी की सामग्री लेता है, केवल फ़ोल्डर के रूप में चिह्नित प्रविष्टियां रखता है, और dot files जैसी छिपी प्रविष्टियां हटा देता है। फिर वह बचे फ़ोल्डरों की क्रमांकित सूची दिखाता है और कुल संख्या बताता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

List and Count Directories

This skill provides a systematic workflow for listing and counting directories within a given path using the list_dir tool. It filters results to identify directories, excludes hidden and system entries, and presents both an enumerated list and a total count.

Use Cases

  • Project structure analysis
  • Skill or module inventory
  • Repository exploration
  • Directory auditing and documentation

Workflow

Step 1: Get Directory Contents

Use list_dir to retrieve the contents of the target path:

list_dir(path="/path/to/target")

Step 2: Identify Directories

Filter the results to identify directory entries. Directories are marked by permissions starting with d in Unix ls format (e.g., drwxr-xr-x).

Recognition pattern:

  • Look for entries where the permissions field starts with d
  • Common directory permission patterns: drwxr-xr-x, drwxrwxr-x, drwx------, etc.

Step 3: Exclude Hidden and System Entries

Filter out entries that should not be counted:

  • . (current directory)
  • .. (parent directory)
  • .DS_Store (macOS metadata)
  • Other hidden files starting with . (optional, depending on requirements)

Step 4: Create Enumerated List

Present the directories as a numbered list for easy reference:

1. directory-name-1
2. directory-name-2
3. directory-name-3
...

Step 5: Provide Total Count

Calculate and report the total number of directories found:

Total: N directories

Implementation Example

When implementing this workflow programmatically, use the following approach:

# Pseudo-code for filtering directories
directories = []
for entry in dir_listing:
    # Check if entry is a directory (starts with 'd')
    if entry['permissions'].startswith('d'):
        name = entry['name']
        # Exclude hidden/system entries
        if name not in ['.', '..', '.DS_Store']:
            directories.append(name)

# Sort for consistent ordering
directories.sort()

# Present enumerated list
for i, dirname in enumerate(directories, 1):
    print(f"{i}. {dirname}")

# Provide total count
print(f"\nTotal: {len(directories)} directories")

Tips

  • Sorting: Always sort directory names alphabetically for consistent, predictable output
  • Context: Mention the path being analyzed for clarity
  • Validation: If the count is zero, verify the path exists and contains directories
  • Extensions: This pattern can be adapted to filter for files, specific extensions, or other criteria

Common Patterns

Basic directory listing with count:

Directories in /skills:
1. authentication-helpers
2. data-processing
3. workflow-automation

Total: 3 directories

With additional context:

Found 3 skill directories in /skills:
1. authentication-helpers
2. data-processing  
3. workflow-automation

Including path context:

Directory inventory for /path/to/modules:
- module-a
- module-b
- module-c
Count: 3 directories

Related Techniques

  • Use similar filtering logic to count files instead of directories (permissions starting with -)
  • Extend to filter by modification date, size, or naming patterns
  • Combine with recursive directory traversal for deep structure analysis
अक्सर पूछे जाने वाले सवाल

एजेंट कैसे जानता है कि प्रविष्टि फ़ोल्डर है?

Unix-शैली की सूचियों में फ़ोल्डरों की अनुमति का पहला अक्षर d होता है।

क्या छिपे फ़ोल्डर गिने जाते हैं?

स्किल dot files जैसी छिपी और सिस्टम प्रविष्टियां बाहर रखती है, हालांकि इसे बदला जा सकता है।

क्या फ़ाइलें भी सूचीबद्ध होती हैं?

नहीं, स्किल सूची और गिनती के लिए केवल डायरेक्टरी प्रविष्टियां रखती है।

जानकारी

लेखक का मूल विवरण

List and count directories in a path by filtering list_dir results for directory entries and excluding hidden/system files

repo: HKUDS/AgentPilot

लोकप्रियता

GitHub स्टार
7.8k
रैंकिंग में स्थान
#13060
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills