Skip to main content
2 of 2
include missing `sed` command
JigglyNaga
  • 8.1k
  • 1
  • 28
  • 48

You could replace the numerical parts of the sequential filenames with #s, using a sed expression (similar to the second one in Freddy's answer). uniq can then remove the duplicate lines:

tree | sed 's/\.[0-9]\+\.jpg/.####.jpg/g' | uniq 

This will still leave two entries for the images (because the final line uses a different symbol in the tree-drawing part), but it has still trimmed the list down to a manageable length:

. |-- directory1 | `-- image_sequence | |-- image.####.jpg | `-- image.####.jpg `-- directory2 |-- someanotherfile.ext2 `-- somefile.ext 
JigglyNaga
  • 8.1k
  • 1
  • 28
  • 48