About 5,310,000 results
Open links in new tab
  1. Given a path, how can I extract just the containing folder name?

    Return the directory name of pathname path. This is the first element of the pair returned by passing path to the function split (). And given the full path, then you can split normally to get …

    Missing:

    • Star

    Must include:

  2. Python folder names in the directory - Stack Overflow

    Mar 23, 2015 · Get all folder names of a directory folder_names = [] for entry_name in os.listdir(MYDIR): entry_path = os.path.join(MYDIR, entry_name) if os.path.isdir(entry_path): …

  3. python 3.x - How to evaluate double asterisk (star) in path?

    Nov 11, 2018 · For python < 3.5. For older Python versions, use os.walk to recursively walk a directory and fnmatch.filter to match against a simple expression: import fnmatch import os …

  4. Python – List Files in a Directory - GeeksforGeeks

    Dec 20, 2024 · Python has provided multiple built-in methods that you can use to know the files present in a directory. This tutorial showed easy methods with examples to understand how to …

    Missing:

    • Star

    Must include:

  5. Get the filename, directory, extension from a path string in Python

    May 8, 2023 · Use os.path.dirname() to get the directory folder (name) from a path string. If you want to get only the directory name directly above the file, use os.path.basename(). Use …

    Missing:

    • Star

    Must include:

  6. File and directory Paths - Python Cheatsheet

    There are two ways to specify a file path. There are also the dot (.) and dot-dot (..) folders. These are not real folders, but special names that can be used in a path. A single period (“dot”) for a …

    Missing:

    • Star

    Must include:

  7. Get a list of file and directory names in Python | note.nkmk.me

    Jul 28, 2023 · In Python, the os.listdir() function allows you to get a list of file and directory (folder) names within a specific directory. In addition to os.listdir(), you can also use the glob module to …

    Missing:

    • Star

    Must include:

  8. Python | os.path.dirname() method - GeeksforGeeks

    Aug 26, 2019 · os.path.dirname() method in Python is used to get the directory name from the specified path. Syntax: os.path.dirname (path) path: A path-like object representing a file …

    Missing:

    • Star

    Must include:

  9. Python Code to Get a List of All Files and Folders in a Directory

    This article explores how to list all files and folders in a directory using Python, with a focus on recursive listing, glob patterns, and filtering strategies. ... This skips any file or folder that has …

    Missing:

    • Star

    Must include:

  10. Getting a list of all subdirectories in the current directory

    Jun 10, 2009 · import os def get_sub_directory_paths(start_directory, sub_directories): """ This method iterates through all subdirectory paths of a given directory to collect all directory paths. …

Refresh