Пример #1
0
 def utimens(self, path, times=None):
     if times is not None:
         access_time, modified_time = times
         file_id = self._get_path_ids(path)[-1]
         File.update(
             updated_at=datetime.datetime.fromtimestamp(modified_time),
             accessed_at=datetime.datetime.fromtimestamp(
                 access_time)).where(File.id == file_id).execute()
Пример #2
0
    def rename(self, old, new):  # Also mv
        dir_ids_org = self._get_path_ids(old)

        dirs_new = new.split('/')
        subpath_new = '/'.join(dirs_new)[:-1]
        dir_ids_new = self._get_path_ids(subpath_new)
        name_new = dirs_new[-1]

        f_org = File.get(id=dir_ids_org[-1])
        File.update(
            name=name_new,
            parent_file=dir_ids_new[-1]).where(File.id == f_org.id).execute()
Пример #3
0
 def chown(self, path, uid, gid):
     file_id = self._get_path_ids(path)[-1]
     File.update(user_owner=uid,
                 group_owner=gid).where(File.id == file_id).execute()
Пример #4
0
 def symlink(self, src, dst):
     file_id = self._get_path_ids(src)[-1]
     File.update(sym_link=dst).where(File.id == file_id).execute()
Пример #5
0
 def chmod(self, path, mode):
     file_id = self._get_path_ids(path)[-1]
     File.update(mode=mode).where(File.id == file_id).execute()