Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
shirosaidev committed Sep 12, 2020
1 parent 4203a28 commit 9c750fb
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions saisoku.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from Queue import Queue
from threading import Thread, Lock
from shutil import copyfile, move, rmtree, Error
from scandir import scandir
from scandir import scandir, walk
from tqdm import tqdm
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
Expand Down Expand Up @@ -445,17 +445,15 @@ def on_modified(self, event):
logger.info(f"{event.src_path} has been modified")
if not event.is_directory:
os.system(f'rsync -uv "{event.src_path}" "{os.path.join(self.dst, event.src_path.replace(self.src, self.dst))}"')
else:
os.system(f'rsync -av "{event.src_path}/" "{os.path.join(self.dst, event.src_path.replace(self.src, self.dst))}"')


def on_moved(self, event):
logger.info(f"{event.src_path} moved to {event.dest_path}")
if event.is_directory:
for dirpath, subdirs, files in os.walk(self.dst):
for dirpath, subdirs, files in walk(self.dst):
if dirpath == event.src_path.replace(self.src, self.dst):
move(dirpath, event.dest_path.replace(self.src, self.dst))
else:
for dirpath, subdirs, files in os.walk(self.dst):
for dirpath, subdirs, files in walk(self.dst):
for file in files:
filepath = os.path.join(dirpath, file)
if filepath == event.src_path.replace(self.src, self.dst):
Expand Down

0 comments on commit 9c750fb

Please sign in to comment.