I need to import a huge number of CSV files into Postgres (Linux). Does anybody know how I can write a script to automate this process?
I am a complete novice. Please help!
You can make a shell script like loop.sh
#!/bin/sh
files=`ls *.sql`
for file in $files
do
echo $file
psql database-name < $file
done
Make the script executable by
chmod 0755 loop.sh
and run it
./loop.sh