Jan-05-2022, 09:22 PM
Im working on a small python file/script that will connect to our FTP server and look for 3 specific files and then download them to our network for processing.
when using the built in ftp functionality (ftplib) does that move the file off the server and onto our network? Or is it a simple "copy" that is occuring?
I ask because i have this code and after i run it and get my 3 files, when i try running it again, there are no files to get.. So i need to know if what i have written is literally moving the files off the server or are they being copied and i need to see if someone else has moved my files...
Everything in my script has worked and didnt think nothing of it until i went to test my logic again and found that there are no files to download anymore.. so i need to make sure that i didnt move them and causing issues for my team.
when using the built in ftp functionality (ftplib) does that move the file off the server and onto our network? Or is it a simple "copy" that is occuring?
I ask because i have this code and after i run it and get my 3 files, when i try running it again, there are no files to get.. So i need to know if what i have written is literally moving the files off the server or are they being copied and i need to see if someone else has moved my files...
for fname in dlList: filesineed = [filename for filename in ftp.nlst() if fname in filename] # GET LISTING OF FILES files = ftp.nlst() for file in filesineed: # CONCATENATED COMMAND AND FILENAME ftpcomm = ftpretr + file ftp.retrbinary(ftpcomm, open(file, 'wb').write)Basically i just want to "copy" the 3 files i need leaving the originals in place on the ftp server for others to use..
Everything in my script has worked and didnt think nothing of it until i went to test my logic again and found that there are no files to download anymore.. so i need to make sure that i didnt move them and causing issues for my team.