René's URL Explorer Experiment


Title: Python's pathlib Module: Taming the File System – Real Python

Open Graph Title: Python's pathlib Module: Taming the File System – Real Python

Description: Python's pathlib module enables you to handle file and folder paths in a modern way. This built-in module provides intuitive semantics that work the same way on different operating systems. In this tutorial, you'll get to know pathlib and explore common tasks when interacting with paths.

Open Graph Description: Python's pathlib module enables you to handle file and folder paths in a modern way. This built-in module provides intuitive semantics that work the same way on different operating systems. In this tutorial, you'll get to know pathlib and explore common tasks when interacting with paths.

Mail addresses
?subject=Python article for you&body=Python's pathlib Module: Taming the File System on Real Python https://realpython.com/python-pathlib/

Opengraph URL: https://realpython.com/python-pathlib/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "Python's pathlib Module: Taming the File System",
  "image": {
    "@type": "ImageObject",
    "url": "https://files.realpython.com/media/Python-3s-pathlib-Module-Taming-the-File-System_Watermarked.524352e6d4ce.jpg",
    "width": 1920,
    "height": 1080
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://realpython.com/python-pathlib/",
    "lastReviewed": "2025-01-11",
    "author": {
      "@type": "Person",
      "name": "Geir Arne Hjelle",
      "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
      "url": "https://realpython.com/team/gahjelle/",
      "affiliation": {
        "@type": "Organization",
        "@id": "https://realpython.com/#organization",
        "name": "Real Python",
        "url": "https://realpython.com",
        "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
      }
    },
    "reviewedBy": [
      {
        "@type": "Person",
        "name": "Aldren Santos",
        "image": "https://realpython.com/cdn-cgi/image/width=500,height=500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Aldren_Santos_Real_Python.6b0861d8b841.png",
        "url": "https://realpython.com/team/asantos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Brenda Weleschuk",
        "image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
        "url": "https://realpython.com/team/bweleschuk/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Bartosz Zaczy\u0144ski",
        "image": "https://realpython.com/cdn-cgi/image/width=1694,height=1694,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/coders_lab_2109368.259b1599fbee.jpg",
        "url": "https://realpython.com/team/bzaczynski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Dan Bader",
        "image": "https://realpython.com/cdn-cgi/image/width=1000,height=1000,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/daniel-square.d58bf4388750.jpg",
        "url": "https://realpython.com/team/dbader/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Joanna Jablonski",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/jjablonksi-avatar.e37c4f83308e.jpg",
        "url": "https://realpython.com/team/jjablonski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Kate Finegan",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/VZxEtUor_400x400.7169c68e3950.jpg",
        "url": "https://realpython.com/team/kfinegan/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Martin Breuss",
        "image": "https://realpython.com/cdn-cgi/image/width=456,height=456,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/martin_breuss_python_square.efb2b07faf9f.jpg",
        "url": "https://realpython.com/team/mbreuss/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Philipp Acsany",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/phi5_2.0e61b4c66f6b.jpg",
        "url": "https://realpython.com/team/pacsany/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      }
    ]
  },
  "datePublished": "2025-01-11T14:00:00+00:00",
  "dateModified": "2025-01-11T14:09:22.541566+00:00",
  "publisher": {
    "@type": "Organization",
    "@id": "https://realpython.com/#organization",
    "name": "Real Python",
    "url": "https://realpython.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
      "width": 512,
      "height": 512
    },
    "description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
    "slogan": "Become a Python Expert",
    "email": "info@realpython.com",
    "sameAs": [
      "https://github.com/realpython",
      "https://www.youtube.com/realpython",
      "https://twitter.com/realpython",
      "https://x.com/realpython",
      "https://www.linkedin.com/company/realpython-com/",
      "https://www.facebook.com/learnrealpython",
      "https://www.instagram.com/realpython",
      "https://www.tiktok.com/@realpython.com"
    ]
  },
  "author": {
    "@type": "Person",
    "name": "Geir Arne Hjelle",
    "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
    "url": "https://realpython.com/team/gahjelle/",
    "affiliation": {
      "@type": "Organization",
      "@id": "https://realpython.com/#organization",
      "name": "Real Python",
      "url": "https://realpython.com",
      "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
    }
  },
  "description": "Python's pathlib module enables you to handle file and folder paths in a modern way. This built-in module provides intuitive semantics that work the same way on different operating systems. In this tutorial, you'll get to know pathlib and explore common tasks when interacting with paths.",
  "hasPart": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "What are the benefits of using pathlib over traditional string paths in Python?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "

The pathlib module provides a more intuitive and readable way to handle file paths with its object-oriented approach, methods, and attributes, reducing the need to import multiple libraries and making your code more platform-independent.

" } }, { "@type": "Question", "name": "How do you instantiate a Path object in Python\u2019s pathlib?", "acceptedAnswer": { "@type": "Answer", "text": "

You can instantiate a Path object by importing Path from pathlib and then using Path() with a string representing the file or directory path. You can also use class methods like Path.cwd() for the current working directory or Path.home() for the user’s home directory.

" } }, { "@type": "Question", "name": "How do you check if a path is a file in Python pathlib?", "acceptedAnswer": { "@type": "Answer", "text": "

You can check if a path is a file by using the .is_file() method on a Path object. This method returns True if the path points to a file and False otherwise.

" } }, { "@type": "Question", "name": "How do you join paths using pathlib?", "acceptedAnswer": { "@type": "Answer", "text": "

You can join paths using the forward slash operator (/) or the .joinpath() method to combine path components into a single Path object.

" } }, { "@type": "Question", "name": "How can you read a file using Python\u2019s pathlib?", "acceptedAnswer": { "@type": "Answer", "text": "

You can read a file using pathlib by creating a Path object for the file and then calling the .read_text() method to get the file’s contents as a string. Alternatively, use .open() with a with statement to read the file using traditional file handling techniques.

" } }, { "@type": "Question", "name": "What method can you use to create an empty file with pathlib?", "acceptedAnswer": { "@type": "Answer", "text": "

You can use the .touch() method of a Path object to create an empty file with pathlib.

" } }, { "@type": "Question", "name": "How can you read and write files using pathlib?", "acceptedAnswer": { "@type": "Answer", "text": "

You can use the .read_text() and .write_text() methods of a pathlib.Path object for reading and writing text files, and .read_bytes() and .write_bytes() for binary files. These methods handle file opening and closing for you.

" } }, { "@type": "Question", "name": "How do you create a unique filename using Python pathlib?", "acceptedAnswer": { "@type": "Answer", "text": "

You can create a unique filename by constructing a path with a counter in a loop, checking for the existence of the file using .exists(), and incrementing the counter until you find a filename that doesn’t exist.

" } } ] } }

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Python-3s-pathlib-Module-Taming-the-File-System_Watermarked.524352e6d4ce.jpg
og:imagehttps://files.realpython.com/media/Python-3s-pathlib-Module-Taming-the-File-System_Watermarked.524352e6d4ce.jpg
twitter:creator@realpython
og:typearticle

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/python-pathlib/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/python-pathlib/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Fpython-pathlib%2F
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics
Intermediatehttps://realpython.com/search?level=intermediate
Advancedhttps://realpython.com/search?level=advanced
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/python-pathlib/#toc
The Problem With Representing Paths as Stringshttps://realpython.com/python-pathlib/#the-problem-with-representing-paths-as-strings
Path Instantiation With Python’s pathlibhttps://realpython.com/python-pathlib/#path-instantiation-with-pythons-pathlib
Using Path Methodshttps://realpython.com/python-pathlib/#using-path-methods
Passing in a Stringhttps://realpython.com/python-pathlib/#passing-in-a-string
Joining Pathshttps://realpython.com/python-pathlib/#joining-paths
File System Operations With Pathshttps://realpython.com/python-pathlib/#file-system-operations-with-paths
Picking Out Components of a Pathhttps://realpython.com/python-pathlib/#picking-out-components-of-a-path
Reading and Writing Fileshttps://realpython.com/python-pathlib/#reading-and-writing-files
Renaming Fileshttps://realpython.com/python-pathlib/#renaming-files
Copying Fileshttps://realpython.com/python-pathlib/#copying-files
Moving and Deleting Fileshttps://realpython.com/python-pathlib/#moving-and-deleting-files
Creating Empty Fileshttps://realpython.com/python-pathlib/#creating-empty-files
Python pathlib Exampleshttps://realpython.com/python-pathlib/#python-pathlib-examples
Counting Fileshttps://realpython.com/python-pathlib/#counting-files
Displaying a Directory Treehttps://realpython.com/python-pathlib/#displaying-a-directory-tree
Finding the Most Recently Modified Filehttps://realpython.com/python-pathlib/#finding-the-most-recently-modified-file
Creating a Unique Filenamehttps://realpython.com/python-pathlib/#creating-a-unique-filename
Conclusionhttps://realpython.com/python-pathlib/#conclusion
Frequently Asked Questionshttps://realpython.com/python-pathlib/#frequently-asked-questions
https://realpython.com/feedback/survey/article/python-pathlib/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/python-pathlib/disliked/?from=article-sidebar
Using Python's pathlib Modulehttps://realpython.com/courses/pathlib-python/
Geir Arne Hjellehttps://realpython.com/python-pathlib/#author
https://realpython.com/python-pathlib/#reader-comments
intermediatehttps://realpython.com/tutorials/intermediate/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
The Problem With Representing Paths as Stringshttps://realpython.com/python-pathlib/#the-problem-with-representing-paths-as-strings
Path Instantiation With Python’s pathlibhttps://realpython.com/python-pathlib/#path-instantiation-with-pythons-pathlib
Using Path Methodshttps://realpython.com/python-pathlib/#using-path-methods
Passing in a Stringhttps://realpython.com/python-pathlib/#passing-in-a-string
Joining Pathshttps://realpython.com/python-pathlib/#joining-paths
File System Operations With Pathshttps://realpython.com/python-pathlib/#file-system-operations-with-paths
Picking Out Components of a Pathhttps://realpython.com/python-pathlib/#picking-out-components-of-a-path
Reading and Writing Fileshttps://realpython.com/python-pathlib/#reading-and-writing-files
Renaming Fileshttps://realpython.com/python-pathlib/#renaming-files
Copying Fileshttps://realpython.com/python-pathlib/#copying-files
Moving and Deleting Fileshttps://realpython.com/python-pathlib/#moving-and-deleting-files
Creating Empty Fileshttps://realpython.com/python-pathlib/#creating-empty-files
Python pathlib Exampleshttps://realpython.com/python-pathlib/#python-pathlib-examples
Counting Fileshttps://realpython.com/python-pathlib/#counting-files
Displaying a Directory Treehttps://realpython.com/python-pathlib/#displaying-a-directory-tree
Finding the Most Recently Modified Filehttps://realpython.com/python-pathlib/#finding-the-most-recently-modified-file
Creating a Unique Filenamehttps://realpython.com/python-pathlib/#creating-a-unique-filename
Conclusionhttps://realpython.com/python-pathlib/#conclusion
Frequently Asked Questionshttps://realpython.com/python-pathlib/#frequently-asked-questions
Remove adshttps://realpython.com/account/join/
Using Python's pathlib Modulehttps://realpython.com/courses/pathlib-python/
Click here to claim your pathlib cheat sheethttps://realpython.com/bonus/python-pathlib-cheat-sheet/
https://realpython.com/python-pathlib/#the-problem-with-representing-paths-as-strings
text stringshttps://realpython.com/python-strings/
oshttps://docs.python.org/3/library/os.html
globhttps://docs.python.org/3/library/glob.html
shutilhttps://docs.python.org/3/library/shutil.html
import statementshttps://realpython.com/absolute-vs-relative-python-imports/
pathlibhttps://docs.python.org/3/library/pathlib.html
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-pathlib/#path-instantiation-with-pythons-pathlib
instead of stringshttps://snarky.ca/why-pathlib-path-doesn-t-inherit-from-str/
official documentation of pathlibhttps://docs.python.org/3/library/pathlib.html
object-oriented approachhttps://realpython.com/python3-object-oriented-programming/
Sourcehttps://docs.python.org/3/library/pathlib.html#module-pathlib
modulehttps://realpython.com/python-modules-packages/
class methodshttps://realpython.com/instance-class-and-static-methods-demystified/
https://realpython.com/python-pathlib/#using-path-methods
Windowshttps://realpython.com/python-pathlib/#windows-1
Linuxhttps://realpython.com/python-pathlib/#linux-1
macOShttps://realpython.com/python-pathlib/#macos-1
PurePath objecthttps://docs.python.org/3/library/pathlib.html#pure-paths
Windowshttps://realpython.com/python-pathlib/#windows-2
Linuxhttps://realpython.com/python-pathlib/#linux-2
macOShttps://realpython.com/python-pathlib/#macos-2
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-pathlib/#passing-in-a-string
Windowshttps://realpython.com/python-pathlib/#windows-3
Linuxhttps://realpython.com/python-pathlib/#linux-3
macOShttps://realpython.com/python-pathlib/#macos-3
escape characterhttps://en.wikipedia.org/wiki/Escape_character
__file__ attributehttps://realpython.com/python-constants/#internal-dunder-names
Portable Operating System Interfacehttps://en.wikipedia.org/wiki/POSIX
Open Group Base Specifications Issue 7https://pubs.opengroup.org/onlinepubs/9699919799/
https://realpython.com/python-pathlib/#joining-paths
os.path.join()https://docs.python.org/3/library/os.path.html#os.path.join
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-pathlib/#file-system-operations-with-paths
operations on your file systemhttps://realpython.com/courses/python-basics-file-system-operations/
https://realpython.com/python-pathlib/#picking-out-components-of-a-path
Windowshttps://realpython.com/python-pathlib/#windows-4
Linuxhttps://realpython.com/python-pathlib/#linux-4
macOShttps://realpython.com/python-pathlib/#macos-4
Click here to claim your pathlib cheat sheethttps://realpython.com/bonus/python-pathlib-cheat-sheet/
https://realpython.com/python-pathlib/#reading-and-writing-files
printhttps://realpython.com/python-print/
Markdownhttps://en.wikipedia.org/wiki/Markdown
read or write a file in Pythonhttps://realpython.com/read-write-files-python/
built-in open()https://docs.python.org/3/library/functions.html#open
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-pathlib/#renaming-files
https://realpython.com/python-pathlib/#copying-files
using shutil for copying fileshttps://realpython.com/working-with-files-in-python/#copying-files-in-python
https://realpython.com/python-pathlib/#moving-and-deleting-files
race conditionhttps://en.wikipedia.org/wiki/Race_condition
exclusive creationhttps://docs.python.org/3/library/functions.html#open
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-pathlib/#creating-empty-files
https://realpython.com/python-pathlib/#python-pathlib-examples
https://realpython.com/python-pathlib/#counting-files
get a list of all the files in a directory with Pythonhttps://realpython.com/get-all-files-in-directory-python/
collections.Counter classhttps://realpython.com/python-counter/
https://realpython.com/python-pathlib/#displaying-a-directory-tree
.rglob() methodhttps://realpython.com/get-all-files-in-directory-python/#recursively-listing-with-rglob
directory tree generator for the command linehttps://realpython.com/directory-tree-generator-python/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-pathlib/#finding-the-most-recently-modified-file
generator expressionshttps://realpython.com/introduction-to-python-generators/
list comprehensionshttps://realpython.com/list-comprehension-python/
epochhttps://realpython.com/python-time-module/#the-epoch
how to get and use the current time in Pythonhttps://realpython.com/python-get-current-time/
https://realpython.com/python-pathlib/#creating-a-unique-filename
https://realpython.com/python-pathlib/#conclusion
Click here to claim your pathlib cheat sheethttps://realpython.com/bonus/python-pathlib-cheat-sheet/
https://realpython.com/python-pathlib/#frequently-asked-questions
https://realpython.com/feedback/survey/article/python-pathlib/liked/?from=article-footer
https://realpython.com/feedback/survey/article/python-pathlib/disliked/?from=article-footer
Using Python's pathlib Modulehttps://realpython.com/courses/pathlib-python/
https://realpython.com/team/gahjelle/
» More about Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/asantos/
Aldrenhttps://realpython.com/team/asantos/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/bzaczynski/
Bartoszhttps://realpython.com/team/bzaczynski/
https://realpython.com/team/dbader/
Danhttps://realpython.com/team/dbader/
https://realpython.com/team/jjablonski/
Joannahttps://realpython.com/team/jjablonski/
https://realpython.com/team/kfinegan/
Katehttps://realpython.com/team/kfinegan/
https://realpython.com/team/mbreuss/
Martinhttps://realpython.com/team/mbreuss/
https://realpython.com/team/pacsany/
Philipphttps://realpython.com/team/pacsany/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-pathlib
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-pathlib
https://realpython.com/feedback/survey/article/python-pathlib/liked/?from=article-comments
https://realpython.com/feedback/survey/article/python-pathlib/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Fpython-pathlib%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20Python%27s%20pathlib%20Module%3A%20Taming%20the%20File%20System&url=https%3A%2F%2Frealpython.com%2Fpython-pathlib%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20Python%27s%20pathlib%20Module%3A%20Taming%20the%20File%20System%20https%3A%2F%2Frealpython.com%2Fpython-pathlib%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Fpython-pathlib%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
intermediatehttps://realpython.com/tutorials/intermediate/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
Using Python's pathlib Modulehttps://realpython.com/courses/pathlib-python/
How to Get a List of All Files in a Directory With Pythonhttps://realpython.com/get-all-files-in-directory-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-pathlib
Working With Files in Pythonhttps://realpython.com/working-with-files-in-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-pathlib
Logging in Pythonhttps://realpython.com/python-logging/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-pathlib
Build Command-Line Interfaces With Python's argparsehttps://realpython.com/command-line-interfaces-python-argparse/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-pathlib
Reading and Writing Files in Python (Guide)https://realpython.com/read-write-files-python/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-pathlib
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-pathlib%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-pathlib%2F
Sign-Inhttps://realpython.com/account/login/?next=/python-pathlib/
Start Herehttps://realpython.com/start-here/
Learning Resourceshttps://realpython.com/search
Code Mentorhttps://realpython.com/mentor/
Python Referencehttps://realpython.com/ref/
Python Cheat Sheethttps://realpython.com/cheatsheets/python/
Support Centerhttps://support.realpython.com/
Learning Pathshttps://realpython.com/learning-paths/
Quizzes & Exerciseshttps://realpython.com/quizzes/
Browse Topicshttps://realpython.com/tutorials/all/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.