Nov-27-2019, 05:22 AM
Hi friends
I am new to python. i tried to write a code for file transfer automation.
actually my requirement is software will generate a folder daily with the name of today's date in server. And inside this folder some other sub folders also created automatically. I should check whether folder was created with today's date. if created then have to check the sub folders on e by one. if the date folder not found program should exit.
pls help me to complete the program.
my coding is....
import os, sys
import os.path
from datetime import date
folder = today.strftime("%Y-%m-%d")
mydir = os.path.exists('/xxx/yyy/zzz/'+ folder)
if mydir == True:
print(str(mydir))
print("yes exists")
dirname = '/xxx/yyy/zzz/{folder}'
filename = 'folder_1, folder_2, folder_3'
#check directory exists
print(dirname)
print(filename)
if(os.path.exists(filename)):
print("Directory Exists")
print(dirname)
else:
print("Directory does not exists")
#check file exists
I am new to python. i tried to write a code for file transfer automation.
actually my requirement is software will generate a folder daily with the name of today's date in server. And inside this folder some other sub folders also created automatically. I should check whether folder was created with today's date. if created then have to check the sub folders on e by one. if the date folder not found program should exit.
pls help me to complete the program.
my coding is....
import os, sys
import os.path
from datetime import date
folder = today.strftime("%Y-%m-%d")
mydir = os.path.exists('/xxx/yyy/zzz/'+ folder)
if mydir == True:
print(str(mydir))
print("yes exists")
dirname = '/xxx/yyy/zzz/{folder}'
filename = 'folder_1, folder_2, folder_3'
#check directory exists
print(dirname)
print(filename)
if(os.path.exists(filename)):
print("Directory Exists")
print(dirname)
else:
print("Directory does not exists")
#check file exists