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";
}
精彩评论