import os file_location = '/srv/volume1/data/eds/eds_report.csv' file_name = os.path.basename(file_location ) #eds_report.csv location = os.path.dirname(file_location ) #/srv/volume1/data/eds