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?

没有正确的解决方案

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top