pyfileseq

File sequence management


Keywords
sequence, file, list, find, fileseq
License
BSD-2-Clause
Install
pip install pyfileseq==1.0.1

Documentation

PyFileSeq, a library for working with file sequences.

Author: Niklas Aldergren <niklas@aldergren.com>

This library will find file sequences in a directory (or another source) and 
return them as a list of FileSequence instances. The FileSequence class 
provides useful functionality for further manipulating a sequence; slicing, 
generation of filenames, string representations, etc.

This is probably most useful when working with applications that
generate a lot of sequential images, e.g. scanning, rendering, etc. It
should (hopefully) support any imaginable file sequence out there and
be reasonably fast.

Usage:

>>> from fileseq import FileSequence
>>> sequences, others = FileSequence.find('/stuff')
>>> sequences[0]
my_sequence.[0001-0005].ext

>>> my_sequence = sequences[0]
>>> for filename in my_sequence.files:
...     print filename
... 
/stuff/my_sequence.0001.ext
/stuff/my_sequence.0002.ext
/stuff/my_sequence.0003.ext
/stuff/my_sequence.0004.ext
/stuff/my_sequence.0005.ext

>>> my_sequence.format("{head}{padchars}{tail}")
'my_sequence.####.ext'