def copy_remote_dir(self, src, dst, *args, **kwargs): """ Copies the entire contents of a directory to another location """ dst = dst + '/' + Init_ABFS.strip_path(src) self.mkdir(dst) other_files = self.listdir(src) for x in other_files: x = src + '/' + Init_ABFS.strip_path(x) self.copy(x, dst)
def __init__(self, isDir, atime, mtime, size, path, owner='', group='', mode=None): self.name = strip_path(path) self.path = path self.isDir = isDir self.type = 'DIRECTORY' if isDir else 'FILE' try: self.atime = abfsdatetime_to_timestamp(atime) if atime else None self.mtime = abfsdatetime_to_timestamp(mtime) if mtime else None except: self.atime = 0 self.mtime = 0 self.size = size self.user = owner self.group = group self.mode = mode or (0o777 if isDir else 0o666) if self.isDir: self.mode |= stat.S_IFDIR else: self.mode |= stat.S_IFREG
def copyfile(self, src, dst, *args, **kwargs): """ Copies a File to another location """ new_path = dst + '/' + Init_ABFS.strip_path(src) self.create(new_path) chunk_size = self.get_upload_chuck_size() file = self.read(src) size = len(file) self._writedata(new_path, file, size)
def __init__(self, isDir, atime, mtime, size, path): self.name = strip_path(path) self.path = path self.isDir = isDir self.type = 'DIRECTORY' if isDir else 'FILE' try: self.atime = abfsdatetime_to_timestamp(atime) if atime else None self.mtime = abfsdatetime_to_timestamp(mtime) if mtime else None except: self.atime = 0 self.mtime = 0 self.size = size