-3

I need to make an array containing over 100 different image names and I wonder if there is any way to "convert" the image names from a folder into a .txt file using terminal to then paste them into xcode instead of manually write all of them. Any advice?

jscs
  • 63,694
  • 13
  • 151
  • 195

1 Answers1

0

You can go to terminal and type

ls                   # list files
ls -lt               # list files with details
ls *.jpg             # list only jpg files
ls > files.txt       # list files and write them to files.txt

The # by the way, is just a comment. You can combine the above commands.

Although I need to say, that the PROPER way of doing this, is letting you code find those files in the desired directory, unless there's a good reason for not doing so.

Merlevede
  • 8,140
  • 1
  • 24
  • 39