How to store directory files listing into an array?

前端 未结 5 637
清酒与你
清酒与你 2021-01-30 13:10

I\'m trying to store the files listing into an array and then loop through the array again. Below is what I get when I run ls -ls command from the console.

5条回答
  •  太阳男子
    2021-01-30 13:31

    I'd use

    files=(*)
    

    And then if you need data about the file, such as size, use the stat command on each file.

提交回复
热议问题