How to execute multiple sql files in postgreSQL linux?

command-line, postgresql-9.1, sql-scripts

Solution

From your command line, assuming you're using either Bash or ZSH (in short, anything but csh/tcsh):

for f in *.sql;
do
    psql coolDB coolUser -f "$f"
done

Problem

I have many .sql files in a folder (/home/myHSH/scripts) in linux debian. I want to know the command to execute or run all sql files inside the folder into postgreSQL v9.1 database. PostgreSQL informations: ``` Database name=coolDB User name=coolUser ``` Nice to have: if you know how to execute multiple sql files through GUI tools too like pgAdmin3.

Original source