sequence.go
func FindSequenceOnDiskPad(pattern string, padStyle PadStyle, opts ...FileOption) (*FileSequence, error) {
	optsCopy := make([]FileOption, len(opts))
	copy(optsCopy, opts)

	var strictPadding bool

	for _, opt := range opts {
		switch opt {

		case FileOptPadStyleHash1:
			padStyle = PadStyleHash1
			optsCopy = append(optsCopy, FileOptPadStyleHash1)

		case FileOptPadStyleHash4:
			padStyle = PadStyleHash4
			optsCopy = append(optsCopy, FileOptPadStyleHash4)

		case StrictPadding:
			strictPadding = true
		}
	}

	fs, err := NewFileSequencePad(pattern, padStyle)
	if err != nil {
		// Treat a bad pattern as a non-match
		fmt.Println(err.Error())
		return nil, nil
	}

	seqs, err := FindSequencesOnDisk(fs.Dirname(), optsCopy...)
	if err != nil {
		return nil, fmt.Errorf("failed to find %q: %s", pattern, err.Error())
	}

	base := fs.Basename()
	ext := fs.Ext()
	pad := fs.Padding()
	fill := fs.ZFill()

	for _, seq := range seqs {
		// Find the first match and return it
		if seq.Basename() != base || seq.Ext() != ext {
			continue
		}

		seq.SetPaddingStyle(padStyle)

		// Strict padding check
		if strictPadding && pad != "" && seq.ZFill() != fill {
			continue
		}

		return seq, nil
	}
	// If we get this far, we didn't find a match
	return nil, nil
}
func FindSequenceOnDiskPad(pattern string, padStyle PadStyle, opts ...FileOption) (*FileSequence, error) {
	optsCopy := make([]FileOption, len(opts))
	copy(optsCopy, opts)

	var strictPadding bool

	for _, opt := range opts {
		switch opt {

		case FileOptPadStyleHash1:
			padStyle = PadStyleHash1
			optsCopy = append(optsCopy, FileOptPadStyleHash1)

		case FileOptPadStyleHash4:
			padStyle = PadStyleHash4
			optsCopy = append(optsCopy, FileOptPadStyleHash4)

		case StrictPadding:
			strictPadding = true
		}
	}

	fs, err := NewFileSequencePad(pattern, padStyle)
	if err != nil {
		// Treat a bad pattern as a non-match
		fmt.Println(err.Error())
		return nil, nil
	}

	seqs, err := FindSequencesOnDisk(fs.Dirname(), optsCopy...)
	if err != nil {
		return nil, fmt.Errorf("failed to find %q: %s", pattern, err.Error())
	}

	base := fs.Basename()
	ext := fs.Ext()
	pad := fs.Padding()
	fill := fs.ZFill()

	for _, seq := range seqs {
		// Find the first match and return it
		if seq.Basename() != base || seq.Ext() != ext {
			continue
		}

		seq.SetPaddingStyle(padStyle)

		// Strict padding check
		if strictPadding && pad != "" && seq.ZFill() != fill {
			continue
		}

		return seq, nil
	}
	// If we get this far, we didn't find a match
	return nil, nil
}
// FindSequenceOnDiskPad takes a string that is a compatible/parsible
// FileSequence pattern, and finds a sequence on disk which matches
// the Basename and Extension. The returned seq will use the given PadStyle.
//
// By default the patterns frame value and padding characters are ignored and
// replaced by a wildcard '*' glob. If you want to match on a specific frame
// padding length, pass the option StrictPadding
//
// If no match is found, a nil FileSequence is returned.
// If an error occurs while reading the filesystem, a non-nil error
// is returned.