Pathlib
File and directory access
Show Current Directory
from pathlib import Path
# Current Working Directory
Path.cwd()
# User Home Directory
home_dir = Path.home()
# Relative path to the current folder
p = Path() # PosixPath('.')
# Parent of path
p.parent
import os
os.getcwd()Check Directory of File Existing
OS Library
Pathlib
Create a Directory
Creating a path by passing folder and filename
Relative path to another path
Comparing two paths
Join Path
File or directory
Moving files with pathlib
Copy file
Path touch
Show Directory Content
Quick Read/Write to File
Metadata of the File
Converting a relative path to an absolute path
Last updated