ftplib python module for download / upload / delete / rename / listing files over FTP server

  Рет қаралды 14,323

Learning Software

Learning Software

Күн бұрын

Пікірлер: 33
@juandiegoflorezruiz
@juandiegoflorezruiz Жыл бұрын
Wasting almost half a day trying to access some ftp. u saved my life with the ssl command. Thank u so much!
@learningsoftwareskills
@learningsoftwareskills Жыл бұрын
You are welcome 👍
@alexthewebdesigner1856
@alexthewebdesigner1856 2 жыл бұрын
Sir, thank you so much for posting.this vid! I wasted 2 hours trying to get Paramiko and PySFTP to work, with no success.
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Hi, thanks for the wonderful feedback 👍
@randor73
@randor73 2 жыл бұрын
Thank you for a great tutorial! You have a knack for explaining things in its simplest terms! Kudos sir!
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Thanks for such a nice feedback👍
@prabhatgupta9808
@prabhatgupta9808 2 жыл бұрын
Hello, Thank you so much for making this wonderful video, this video is exactly what i was looking for. just few more doubts i have, i would really appreciate if you could respond. 1. is there any way we can copy/move files from one dir to another dir on ftp? 2. can we read the file on ftp before downloading (as per my requirement i need to check if file is relevant before downloading it). Thanks in advance, keep up the good work.
@learningsoftwareskills
@learningsoftwareskills Жыл бұрын
Hi, thanks for your appreciation 1. You can explore the rename command to move files remotely the FTP server ( docs.python.org/3/library/ftplib.html#ftplib.FTP.rename ) 2. You can read the contents of an FTP file into a variable using retrlines command as shown in the below example ( docs.python.org/3/library/ftplib.html#ftplib.FTP.retrlines ) lines = [] filename="abcd.txt" ftp.retrlines("RETR " + filename, lines.append) Hope this helps, Cheers👍
@arushichoudhary1380
@arushichoudhary1380 2 жыл бұрын
Thank u it was extremely helpful ,can u also provide a solution about how to find the timestamps of the files on ftp server
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Hi, I have found a solution at stackoverflow.com/a/29027386/2746323 If you want to find the timestamp of a single file, you can use ######################### code start timestamp = ftp.voidcmd("MDTM /remote/path/file.txt")[4:].strip() time = parser.parse(timestamp) ######################### code end If you want to find the timestamps of all the files in a remote folder, you can use ######################### code start from ftplib import FTP from dateutil import parser # ... (connection to FTP) files = ftp.mlsd("/remote/path") for file in files: name = file[0] timestamp = file[1]['modify'] time = parser.parse(timestamp) print(name + ' - ' + str(time)) ######################### code end Hope this helps Cheers👍
@23nassim92
@23nassim92 2 жыл бұрын
thank you ur the best
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Thanks for the awesome feedback 👍
@arushichoudhary1380
@arushichoudhary1380 2 жыл бұрын
Thanku so much it helped a lot also can u please tell me if hostname is some IP address instead of localhost so can the code still works because I;m trying and it is showing me some error
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Hi, using a hostname like "15.25.56.76" is valid. Please mention what error you are getting. You can also check if ssl is required. Also check the connectivity with winscp. Hope this helps Cheers 👍
@arushichoudhary1380
@arushichoudhary1380 2 жыл бұрын
Thank you that was helpful
@pradeepkumar-h9u7r
@pradeepkumar-h9u7r 5 ай бұрын
Hello Sir, how can we copy folders over ftp?
@learningsoftwareskills
@learningsoftwareskills 5 ай бұрын
Hi, you can't directly copy folders to FTP. You can create a folder in the remote server using the ftp.mkd command and then copy all the files one by one. Hope this helps, cheers 👍
@AndrésEduardoSuárezRojas
@AndrésEduardoSuárezRojas Жыл бұрын
Gracias!!!
@learningsoftwareskills
@learningsoftwareskills Жыл бұрын
Thanks 👍
@bawadhut
@bawadhut 2 жыл бұрын
👍🏼
@sn-op8oi
@sn-op8oi 2 жыл бұрын
Hi is there any process to send file from server location A to another server location B
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Hi, there can be several approaches to solve this problem depending on the security considerations. You can host an FTP server at location A and host the files in the FTP folder, and copy that file to location B using a script in server B. Hope this helps, Cheers👍
@sn-op8oi
@sn-op8oi 2 жыл бұрын
Hi I need to download the names of those files which were uploaded in last 48 hours. How do I extract the time stamp and get those file names?
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Hi, use can use ftplib MLSD function to get the modified times along with filenames of all files in an FTP directory. Please see the solution in this link stackoverflow.com/a/29027386 Hope this helps, Cheers 👍
@sn-op8oi
@sn-op8oi 2 жыл бұрын
@@learningsoftwareskills mlsd is blocked is there any other way?
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
@@sn-op8oi Hi, then you can use ftp.dir command. The example code is present in the same stackoverflow post at stackoverflow.com/questions/29026709/how-to-get-ftp-files-modify-time-using-python-ftplib/29027386#29027386 Cheers 👍
@ieatmagic8053
@ieatmagic8053 2 жыл бұрын
how to overwrite folders in ftp ?
@learningsoftwareskills
@learningsoftwareskills 2 жыл бұрын
Hi, if you want to upload the contents of a whole folder, you can iterate through each file of the local folder using a for loop and upload each file using the storbinary function ( 09:38 ). If a file exists, it will be overwritten anyway. If you have nested folders, you have to ensure them in the remote location before uploading files in nested folders. Unfortunately, You have to implement the above algorithm yourself. If I find any implementation online, I will comment here Hope this helps, Cheers👍
@jaikumarm6964
@jaikumarm6964 Жыл бұрын
hi iam getting erro:socket.timeout:timeout in ftp
@learningsoftwareskills
@learningsoftwareskills Жыл бұрын
Hi, this may be due to firewall policy blocking or network issues. Please check the firewall policy Hope this helps, Cheers 👍
@jaikumarm6964
@jaikumarm6964 Жыл бұрын
Thank you
@fadeblox149
@fadeblox149 Жыл бұрын
i awant to upload dir
@learningsoftwareskills
@learningsoftwareskills Жыл бұрын
Hi, you can use ftp.mkd to create a folder in the FTP server, then upload the files in the created folder. Hope this helps, cheers 👍
SFTP in python with pysftp along with examples
24:30
Learning Software
Рет қаралды 23 М.
Automate FTP Transfers with Python
31:58
AIP IT Solutions
Рет қаралды 735
Try Not To Laugh 😅 the Best of BoxtoxTv 👌
00:18
boxtoxtv
Рет қаралды 7 МЛН
This dad wins Halloween! 🎃💀
01:00
Justin Flom
Рет қаралды 59 МЛН
How to Use FTP / FTP_TLS in Python to List, Upload, and Download Files
13:43
Sean MacKenzie Data Engineering
Рет қаралды 4,9 М.
Simple FTP Server in Python
12:13
NeuralNine
Рет қаралды 24 М.
Download Multiple Files (or ULRs) in Parallel with Python
15:12
Geospatial School
Рет қаралды 10 М.
get the latest file from an ftp folder with python ftplib
13:53
Learning Software
Рет қаралды 1,9 М.
Create your own AI Assistant | Python | 2022
40:19
Mikael Codes
Рет қаралды 160 М.
Iterating through files inside a folder using the glob module in python
9:15
Simple Automated SSH Python Bot
17:50
NeuralNine
Рет қаралды 32 М.
FTP - A-Z of Python
38:02
Chris Vaden
Рет қаралды 12 М.