move files;cleanup empty folders
This commit is contained in:
parent
4b5fedb7a8
commit
173fde1d1b
2 changed files with 7 additions and 0 deletions
|
@ -618,6 +618,8 @@ class File(db.Model):
|
|||
shutil.move(current_path, path)
|
||||
self.path = new_path
|
||||
self.save()
|
||||
for folder in set(os.path.dirname(p) for p in [current_path, path]):
|
||||
remove_empty_folders(folder)
|
||||
|
||||
def save(self):
|
||||
state.db.session.add(self)
|
||||
|
|
|
@ -43,6 +43,11 @@ def remove_missing():
|
|||
dirty = True
|
||||
if dirty:
|
||||
state.db.session.commit()
|
||||
for f in File.query:
|
||||
if not state.tasks.connected:
|
||||
return
|
||||
f.move()
|
||||
remove_empty_folders(prefix)
|
||||
|
||||
def add_file(id, f, prefix, from_=None):
|
||||
user = state.user()
|
||||
|
|
Loading…
Reference in a new issue