Jan-16-2020, 05:17 PM
I use below code. Here, the there will be 4 levels (subfolders) so I use
Exammple: Rootfolder/project/cataegory after this I do not know folder names, but there will be 4 more subfolders and in the last folder my file exist.
My file name is: .Dailycollection.log
If file exist after this : Rootfolder/project/cataegory, then I want to capture full path of the file.
p = Path("D:\Mekala_Backupdata\*\*\*\*\")
csv_files = [csvfile for csvfile in p.iterdir() if csvfile.is_file() and csvfile.suffix == '*.Dailycollection.log']
for filename in csv_files:
print(filename)
Exammple: Rootfolder/project/cataegory after this I do not know folder names, but there will be 4 more subfolders and in the last folder my file exist.
My file name is: .Dailycollection.log
If file exist after this : Rootfolder/project/cataegory, then I want to capture full path of the file.
p = Path("D:\Mekala_Backupdata\*\*\*\*\")
csv_files = [csvfile for csvfile in p.iterdir() if csvfile.is_file() and csvfile.suffix == '*.Dailycollection.log']
for filename in csv_files:
print(filename)