info@iova.co.uk
IOVA
  • Home
  • Services
    • Digital Marketing
      • Google Ads
      • Social Media Ads
      • E-mail Marketing
      • Search Engine Optimization
    • Cybersecurity
    • E-Commerce
    • Point Of Sale System
      • Supermarket POS
      • Restaurant POS
      • Grocery POS
      • Textile Clothing Store POS
      • Butcher Store POS
      • Cosmetic Store POS
      • Canteen POS
      • Greengrocer POS
      • Herbalist POS
  • Projects
  • Shop
  • About Us
  • Contact
Product has been added to your cart.

Python – FTP’ye otomatik dosya yükleme ( Upload )

Posted on January 12, 2016
1 Comment

Merhabalar , bu programımızı yazmadan önce 4 tane modül import ediyoruz.

Modüller : ftplib , os , schedule , time

Kodlar : 

from ftplib import FTP
import os
import schedule
import time

## Açılacak ekranda print komutuyla istediğimizi yazdırıyoruz.
print (“Resim yukleme sistemi\nHer gece 02:00’de resimler guncellenmektedir.\nKaresoft”)

def yukle():
f = FTP(‘ftp.siteniz.com‘)
f.login(“FTP KULLANICI“,”FTP ŞİFRE“)
f.cwd(“FTP YÜKLENECEK KLASÖR”) #Örnek /public_html/resimler/
dizin=”PC DEKİ DOSYA YOLU” # Örnek C:\webresim\\
def upload(ftp,file):
ext = os.path.splitext(file)[1] file2=file
file=dizin+file
if ext in (“.txt”, “.htm”, “.html”):
f.storlines(“STOR ” + file2, open(file))
else:
f.storbinary(“STOR ” + file2, open(file, “rb”), 1024)
for i in os.listdir(dizin):
upload(f,i)
# f.retrlines(‘LIST’)
f.quit()

#Program hergün saat kaçta çalışmasını istiyorsak yazıyoruz
schedule.every().day.at(“02:00”).do(yukle)
while 1:
schedule.run_pending()
time.sleep(1)

Sizde kendinize göre özelleştirebilir cx_Freeze veya py2exe modülleri ile exe’ye çevirip windows ortamında kullanabilirsiniz.

Karşılaştığınız hataları bize yorum atarak sorabilirsiniz.

 

Previous Post
Python ( Print Komutu )
Next Post
Python ( MySQL Bağlantısı ve Sınıfı )

1 Comment. Leave new

  • Lokman Mumcu
    August 17, 2017 1:39 pm

    Kodu çalıştırdım. Fakat name ‘file’ is not defined hatası alıyorum. Nerelerde düzeltme yapmam gerekiyor. Emekleriniz için teşekkür ederim.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Recent Posts

  • Ingiltere’de Sirketinizi Kurun June 5, 2021
  • Self Assessment Nedir? Öz Değerlendirme February 28, 2021
  • UK Postcode Data with Address, Longitude and Latitude Download October 31, 2020
  • National Insurance Number Nasil Alinir? ( NiNo ) September 30, 2020
  • Deliveroo Hesabi Acmak – Ingiltere’de September 23, 2020

Categories

  • E-ticaret (2)
  • Eğitimler (2)
  • Genel (1)
  • Haberler (1)
  • Javascript (1)
  • Kivy ( Android & IOS) Dersleri (1)
  • Node JS Dersleri (2)
  • OpenCart (1)
  • PHP Dersleri (2)
  • Python Dersleri (4)
  • Uncategorized (5)
  • Uygulamalar (4)

About US

Since 2004, we have been providing software, integration, digital marketing, social media management, cyber security, SEO and other specialized software.

Get a Request

Contacts

info@iova.co.uk
Facebook
LinkedIn

© 2020 IOVA LTD

This website uses cookies to improve your experience. If you continue to use this site, you agree with it.