A collection of utilities for CGI-VFX to copy files from one place to another, find out basic stat differences between them and handle file sequences and textures (tx files).
pip install synchronizer
- Process paths
trg_path. Takes both files and directories as source. If given source is a file and it’s part of a sequence it’ll find and copy the entire sequence of files.
from synchronizer import copier copier.process_paths(src_path, trg_path, force_overwrite=True, **kwargs) ''' kwargs: include_tx = True only_tx = True find_sequence = True '''
- Sync status
Compares two files or directory paths and return sync status. Sync status refers to
from synchronizer import syncstatus syncstatus.get_sync_status( src_path, trg_path, ignore_name=False, ignore_stats=['st_uid', 'st_gid', 'st_atime', 'st_ctime', 'st_ino', 'st_dev'])
- Get most recent
Compares two paths and returns whichever has the most recent stat time. Default stat used for comparison is
st_mtimewhich is: Time of most recent content modification.
from synchronizer import syncstatus syncstatus.get_most_recent(src_path, trg_path, use_stat='st_mtime')
- Get sequence files
Find and return all files that are part of a sequence matching
file_path. If no sequence found, returns
None. Two files are enough to make a sequence, even if they’re not sequential. This assumes the sequence digits are right beside the file extension.
from synchronizer import utils utils.get_sequence_files(file_path)