rsync + watchdog case, watchdog event.src_path return temporary file path not origin file

Viewed 9

in my project, copied AWS ec2 directory used by rsync. and monitoring that copy directory by python watchdog

it my wathdog code

class Handler(FileSystemEventHandler):
    ...
    def on_modified(self, event):
        if not event.is_directory:
            origin_file_path = event.src_path
            file_name = os.path.basename(event.src_path)
            print(file_name)
        return super().on_modified(event)
    ...

it's working good but, suddenly result return changed like this

/usr/myproject/.test.py.wcP5y9

so i found that pattern .<filename>.<randomstring>. it is rsync temporary file when transfer data and it will be delete after transfer

but my code still return .<filename>.<randomstring>.

i just need file name & path...what can i do to solved this problem?

0 Answers
Related