-2

I have a folder that contains several files with different formats (.mpg, .jpg, .mov etc), in addition to several image sequences.

I also have a code that takes an image sequence like:

img.000000.jpg
img.000001.jpg
img.000002.jpg
...

And turns it into:

img.%06d.jpg

Is there a way to list all of my image sequences and other files in a given folder? (no sub-folders)

Thanks!

EDIT

If i have 5 different .jpg sequences in my folder, i want to have them in 5 separate lists.. not have just one list that contains all of the .jpg files in the folder.

Sample input:

file1.log
file2.001.jpg
file2.002.jpg
file2.003.jpg
movie.avi
photo.png
seq.001.jpg
seq.002.jpg
seq.003.jpg

Output:

file1.log
file2.%03d.jpg
movie.avi
photo.png
seq.%03d.jpg
Gambit2007
  • 3,260
  • 13
  • 46
  • 86

1 Answers1

1

You can use python glob

glob.glob("img*.jpg")

glob Return a possibly-empty list of path names that match pathname, which must be a string containing a path specification. pathname can be either absolute (like /usr/src/Python-1.5/Makefile) or relative (like ../../Tools//.gif), and can contain shell-style wildcards. Broken symlinks are included in the results (as in the shell).

Haifeng Zhang
  • 30,077
  • 19
  • 81
  • 125