Oct-03-2021, 01:08 PM
Use pathlib then it become much more flexible.
>>> import pathlib >>> >>> dst = r"C:\Users\tekno\Documents\Client Drawings\AAA001" >>> folder_last = pathlib.PurePath(dst).name >>> folder_last 'AAA001' >>> >>> # Join would be >>> my_path = pathlib.Path('C:\\') >>> my_path.joinpath(folder_last) WindowsPath('C:/AAA001') >>> pathlib.Path.home().joinpath(folder_last) WindowsPath('C:/Users/Tom/AAA001')