This is a simple method how to list file or directory with bash programming : #!/bin/sh DIR_LOC=/home/toto for i in $DIR_LOC/* do echo "Process file $i" done If we want to filter ouput data (example : we want to filter list file with *.sh tipe data, so we can change code with : #!/bin/sh DIR_LOC=/home/toto