pgFormatter icon indicating copy to clipboard operation
pgFormatter copied to clipboard

Run recursively on directory

Open kevinmichaelchen opened this issue 2 years ago • 1 comments

Is it possible to run this recursively on all SQL files under a directory?

kevinmichaelchen avatar Mar 23 '23 23:03 kevinmichaelchen

Something like that should do the work:

find mydir/ -name '*.sql' | xargs -i pg_format -o {}.out {}

the formatted files will have the extension .out or if you want to override the existing SQL files you can do something like that:

find mydir/ -name '*.sql' | xargs -i pg_format -i {}

darold avatar Mar 24 '23 06:03 darold