mirror of
https://codeberg.org/vlw/cloud-backup.git
synced 2025-09-14 01:53:42 +02:00
15 lines
No EOL
363 B
Python
15 lines
No EOL
363 B
Python
import os.path
|
|
import ntpath
|
|
|
|
# Check if a file exists
|
|
def file_exists(file: str) -> bool:
|
|
return os.path.isfile(file)
|
|
|
|
# Get parent directory of file
|
|
def get_parent(path: str) -> str:
|
|
return os.path.dirname(path)
|
|
|
|
# Get filename from path string
|
|
def get_file(path: str) -> str:
|
|
head, tail = ntpath.split(path)
|
|
return tail or ntpath.basename(head) |