Advertisement
MRtecno98

ftpCore V.1.0.0

May 20th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. #This is a core of techcore(yes a core of a core xD) and contains ftp utilities
  2. #Requires Tehchcore V.1.2.0
  3.  
  4. from ftplib import FTP
  5. import os
  6.  
  7. def uploadFile(ftp , file , remotePath) :
  8.         ftp.cwd(remotePath)
  9.         ftp.storlines("STOR " + file.name.split("\\")[-1] , file)
  10.  
  11. def downloadFile(ftp , file , remotePath , bitrate) :
  12.         directory = os.path.dirname(remotePath)
  13.         filename = os.path.basename(remotePath)
  14.         ftp.cwd(directory)
  15.         #print(filename , directory , type(file) , bitrate)
  16.         ftp.retrbinary("RETR " + filename , file.write , bitrate)
  17.  
  18. def deleteFile(ftp , path) :
  19.         directory = os.path.dirname(path)
  20.         filename = os.path.basename(path)
  21.         ftp.cwd(directory)
  22.         ftp.delete(filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement