I have tftp
server where I have put some files. Now I need to get files of a particular type from the server.
This is what I currently do to get a file I know the name of
ip = '10.12.43.122'
def get_file():
time = datetime.utcnow()
filename = 'snapshot.' + ip + '.' + str(time.day) + '-' + str(time.month) + '-' + str(time.year)
print("filename", filename)
cmd = 'tftp -v ' + TFTP_SERVER + ' -c get ' + filename
output = subprocess.check_output(cmd, shell=True)
print("output", output)
get_file()
I get a message that the file is downloaded. But here I know what exactly the file is called.
What I want to do is to get the files that contains the ip
mentioned. In the above, you can see I have defined an ip
and it gets the particular file. Now I want to get all the files having that ip
in their name. How do I do it?