3

I'm trying to recursively open all the files in a folder, including its directories. I've been playing around with open /path/to/folder/*, and this will open all the files inside that folder but not include the sub-directories.

If I had a folder tree that looked like this:

Folder
>subfolder1
>>file1.jpg
>>file2.jpg
>subfolder2
>>file1.jpg
>>file2.jpg
>subfolder3
>>file.jpg

How could I open all the files in one terminal command?

1 Answer 1

6

I would suggest

find . | xargs open
3
  • 1
    Note that this has the potential to massively slow down / crash your system if you run it in the wrong folder... =P It won't ask if you really want to open every single file on your computer.
    – daviewales
    Commented May 20, 2013 at 6:11
  • As a side note, you can also use "find ./*/*.jpg | xargs open" if there are non jpg files that you want to ignore. Commented May 9, 2014 at 12:38
  • 1
    I would rather use find . -name "*.jpg" Commented May 9, 2014 at 16:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .