开发者

Bash - How to retrieve all names file of a directory?

I need to get all filename in a directory

Example (in PHP)

$filenames = array();

foreach($filenames a开发者_如何学运维s $filename)
{
   Execute('sh testname.sh $filename'); 
}

1)How to get $filenames array?

2) How to translate this in Batch?


#!/bin/sh

for file in *
do
  sh "$file"
done


This should do it too - using PHP. You can specify what types of file you want by messing about with the * part

$files = glob("/tmp/*");

foreach($files as $file) {

  echo "{$file}\n";

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜