def do_pull(self, user_args): args = user_args.split() if len(args) != 2: out = "." path = user_args else: out = args[1] path = args[0] f = self.afc.get_file_info(path) if not f: logging.debug("Source file does not exist..") return out_path = out + "/" + path if f['st_ifmt'] == 'S_IFDIR': if not os.path.isdir(out_path): os.makedirs(out_path, MODEMASK) for d in self.afc.read_directory(path): if d == "." or d == ".." or d == "": continue self.do_pull(path + "/" + d + " " + out) else: data = self.afc.get_file_contents(path) if data: if data and path.endswith(".plist"): z = parsePlist(data) plistlib.writePlist(z, out_path) else: with open(out_path, 'wb+') as f: f.write(data)
def do_pull(self, user_args): args = user_args.split() if len(args) != 2: out = "." path = user_args else: out = args[1] path = args[0] f = self.afc.get_file_info(path) if not f: print("Source file does not exist..") return out_path = out + "/" + path if f['st_ifmt'] == 'S_IFDIR': if not os.path.isdir(out_path): os.makedirs(out_path, MODEMASK) for d in self.afc.read_directory(path): if d == "." or d == ".." or d == "": continue self.do_pull(path + "/" + d + " " + out) else: data = self.afc.get_file_contents(path) if data: if data and path.endswith(".plist"): z = parsePlist(data) plistlib.writePlist(z, out_path) else: with open(out_path, 'wb+') as f: f.write(data)
def do_cat(self, p): data = self.afc.get_file_contents(self.curdir + "/" + p) if data and p.endswith(".plist"): pprint(parsePlist(data)) else: print(data)
def do_cat(self, p): data = self.afc.get_file_contents(self.curdir + "/" + p) if data and p.endswith(".plist"): logging.debug(parsePlist(data)) else: logging.debug(data)