Aiuto FTP

« Older   Newer »
  Share  
The_Jokers
CAT_IMG Posted on 21/3/2011, 23:59     +1   -1




ragazzi forse pretendo troppo dalla vita però che qualcuno che mi posta il codice sorgente per scaricare file via ftp , io ho gia provato ma non mi funziona vi posto il la sorgente.
SPOILER (click to view)
CODICE
def download(ftp,directory,file_m):
    apri_file = open(file_m,'wb')
    ftp.retrbinary('RETR '+ file_m,apri_file.write)
    apri_file.close()
download(apri_con,'D:\\','ciao.txt')

grazie :D
 
Top
xMasteRx
CAT_IMG Posted on 22/3/2011, 05:19     +1   -1




come sapete il mio piccolo campo di programmazione che so fare il minimo sufficiente per aiutare qualcuno è autoit quindi non posso farci niente xD
 
Top
I.Ren
CAT_IMG Posted on 22/3/2011, 14:03     +1   -1




Questo è la funzione che usavo su ftpremoteexc:

CODICE
def _ftp_file_read(remfile,mode='wb'):
   tmpdir = tempfile.gettempdir()
   locfile = tmpdir+'\\dwnlodd.tmp'
   ftp.retrbinary('RETR '+remfile, open(locfile, mode).write)
   o = open(locfile,'r')
   leg = o.read()
   o.close()
   os.remove(locfile)
   return leg


basta che la modifichi così: (non l'ho provata ma teoricamente)

CODICE
def _ftp_file_read(remfile,locfile,mode='wb'):
   ftp.retrbinary('RETR '+remfile, open(locfile, mode).write)
 
Top
The_Jokers
CAT_IMG Posted on 22/3/2011, 22:17     +1   -1




grazie I.ren ora provo
xmasterx non fa niente lol
 
Top
The_Jokers
CAT_IMG Posted on 23/3/2011, 20:44     +1   -1




non va i.ren non scarica quello che deve scaricare
help help me
 
Top
I.Ren
CAT_IMG Posted on 23/3/2011, 21:06     +1   -1




Domani provo e ti fo sapere.
 
Top
The_Jokers
CAT_IMG Posted on 23/3/2011, 21:07     +1   -1




ok grazie I.ren ti devo un favore
 
Top
I.Ren
CAT_IMG Posted on 24/3/2011, 14:13     +1   -1




Ecco così funziona

CODICE
from ftplib import FTP

def _ftp_file_read(remfile,locfile,mode='wb'):
  ftp.retrbinary('RETR '+remfile, open(locfile, mode).write)

ftp = FTP('tuositoftp')
ftp.login('nomeutente','password')
_ftp_file_read('file_remoto.html','file_locale.html')
ftp.quit()
 
Top
The_Jokers
CAT_IMG Posted on 24/3/2011, 20:24     +1   -1




I.ren se un genio grazie mi hai risolto tanti problemi
 
Top
I.Ren
CAT_IMG Posted on 24/3/2011, 20:34     +1   -1




prego
 
Top
9 replies since 21/3/2011, 23:59   168 views
  Share