Create .txt in a FTP folder?
Hello. I managed to connect to my ftp and create a new directory with ftp.mkd(folderName). However, I want to create a txt file within this folder and write in it with another string. In quick steps:
- Create a blank .txt file (in a FTP folder, that's the important part)
- Add text to the .txt file.
How it gets done?
MAYBE, I fixed by creating a local file, there we go:
article = 'This is my whole article.'
ftp.storlines('STOR ' + path/to/folder/article.txt, open('article.txt','r'))
I believe this generates a local text file in my device, so I thought about using os.remove to delete it afterwards, does it work as I could expect?
It all looks right to me. Is it doing all the stuff that you had hoped it would?
I used the indispensable Shellista to verify that: 1) the local file is getting created, 2) has the right content, and 3) is getting properly deleted.
Thank you for Shellista. And for confirming that my local file is being deleted.