This repository is a basic guide to using the os
module in Python for various operations related to directories.
The os
module in Python provides a wide range of functions for working with directories, files, and paths. This repository
is designed to help you understand and utilize the capabilities of the os
module to effectively manage directories,
create and remove directories, access file information, and more.
We cover the following topics related to working with directories using os
module:
- Getting Current Working Directory: Learn how to determine the current directory your Python script is running in.
- Creating Directories: Explore how to create new directories programmatically.
- Listing Directory Contents: Discover methods to list the contents of a directory, including sub-directories and files.
- Accessing File Information: Use the
os.path
functions to retrieve information about files. - Renaming and Removing Directories: Learn how to rename and delete directories using Python.
To explore and practice the examples in this repository, follow these steps:
-
Clone the repository:
git clone https://github.com/kapil-malviya/working-with-directories.git
-
Navigate to a specific topic directory:
cd working-with-directories/
-
Run the Python script to see the examples in action:
python3 know-content-of-dir.py
Contributions to this repository are welcome! If you have additional examples, improvements, or fixes, please consider opening a pull request.