func preparePaths(paths []string) ([]string, fileseq.FileSequences) {
	var (
		fi  os.FileInfo
		err error
	)

	dirs := make([]string, 0)
	seqs := make(fileseq.FileSequences, 0)
	previous := make(map[string]struct{})

	for _, p := range paths {
		p := strings.TrimSpace(filepath.Clean(p))
		if p == "" {
			continue
		}

		if _, seen := previous[p]; seen {
			continue
		}
		previous[p] = struct{}{}

		if fi, err = os.Stat(p); err != nil {

			// If the path doesn't exist, test it for
			// a valid fileseq pattern
			if seq, err := fileseq.NewFileSequence(p); err == nil {
				seqs = append(seqs, seq)
				continue
			}

			fmt.Fprintf(errOut, "%s %q: %s\n", ErrorPath, p, err)
			continue
		}

		if !fi.IsDir() {
			continue
		}

		dirs = append(dirs, p)
	}

	return dirs, seqs
}
func preparePaths(paths []string) ([]string, fileseq.FileSequences) {
	var (
		fi  os.FileInfo
		err error
	)

	dirs := make([]string, 0)
	seqs := make(fileseq.FileSequences, 0)
	previous := make(map[string]struct{})

	for _, p := range paths {
		p := strings.TrimSpace(filepath.Clean(p))
		if p == "" {
			continue
		}

		if _, seen := previous[p]; seen {
			continue
		}
		previous[p] = struct{}{}

		if fi, err = os.Stat(p); err != nil {

			
			
			if seq, err := fileseq.NewFileSequence(p); err == nil {
				seqs = append(seqs, seq)
				continue
			}

			fmt.Fprintf(errOut, "%s %q: %s\n", ErrorPath, p, err)
			continue
		}

		if !fi.IsDir() {
			continue
		}

		dirs = append(dirs, p)
	}

	return dirs, seqs
}
func preparePaths ( paths [ ] string ) ( [ ] string , fileseq . FileSequences ) { var ( fi os . FileInfo err error ) dirs := make ( [ ] string , 0 ) seqs := make ( fileseq . FileSequences , 0 ) previous := make ( map [ string ] struct { } ) for _ , p := range paths { p := strings . TrimSpace ( filepath . Clean ( p ) ) if p == " " { continue } if _ , seen := previous [ p ] ; seen { continue } previous [ p ] = struct { } { } if fi , err = os . Stat ( p ) ; err != nil { // If the path doesn't exist, test it for // a valid fileseq pattern if seq , err := fileseq . NewFileSequence ( p ) ; err == nil { seqs = append ( seqs , seq ) continue } fmt . Fprintf ( errOut , " \n " , ErrorPath , p , err ) continue } if ! fi . IsDir ( ) { continue } dirs = append ( dirs , p ) } return dirs , seqs }
// Take a list of paths and reduce them to cleaned
// and unique paths. Return two slices, separated by
// directory paths, and sequence patterns
Take a list of paths and reduce them to cleaned and unique paths . Return two slices separated by directory paths and sequence patterns