Skip to content

Latest commit

 

History

History
47 lines (28 loc) · 1.77 KB

OS_Check_path_exist.md

File metadata and controls

47 lines (28 loc) · 1.77 KB



Template request | Bug report | Generate Data Product

Tags: #os #python #path #file #system #library #snippet #operations #check

Author: Benjamin Filly

Description: This notebook will show how to check a path exist using os library.

References:

Input

Import libraries

import os

Setup Variables

  • path: file path in your local system. If you are using Naas you should start with /home/ftp to locate your file
path = '/home/ftp/__templates__' # Specify path

Model

Check if path exists

This function will check the precise location of the file or directory in a file system you put in the variable

is_exist = os.path.exists(path) # Check whether the specified path exists or not

Output

Display result

print("Is the path existing ?")
print(is_exist)