Exemplo n.º 1
0
 def download_recursion(self, path, filename_filter):
     root = get_domain(self.url)
     # List all dir and create them
     directories = self.get_all_directories(path)
     Log.success("Directories : \n%s" % list2string(directories, "\t[", "]\n"))
     Log.info("Create directories locally...")
     for d in directories:
         p = root + d
         Log.info("Creating : [%s]" % (p))
         try:
             os.makedirs(p)
         except Exception as e:
             Log.error(str(e))
     # Download
     Log.info("Listing all files...")
     result = self.auto_exec("find %s -type f -name '%s'" % (path, filename_filter))
     if result[0]:
         Log.success("Listing files success!")
         content = result[1].split("\n")[0:-1]
         for file in content:
             p = root + file
             Log.info("Downloading %s to %s" % (file, p))
             self.download_base(file, p)
     else:
         Log.error("Listing files error!")
Exemplo n.º 2
0
 def download(self, remote_file_path, local_file_path):
     root = get_domain(self.url)
     path = root + local_file_path
     Log.info("Local path : [%s]" % (path))
     local_directory = path[0:-path[::-1].index("/")]
     Log.info("Creating : [%s]" % (local_directory))
     try:
         os.makedirs(local_directory)
     except Exception as e:
         Log.error(str(e))
     self.download_base(remote_file_path, path)