I have a number of sql files to import. For a single file I use the following command:mysql -u root -p dbname < db.sqlIs it possible to use xargs to bulk import all files? something like:ls *.sql | xargs ....I know that mysqlimport is the solution but I want to know if it's possible with xargs or not.
Import sql files using xargs
mysql;xargs;input
xargs is suitable to transform input into command line parameters. But as mysql not accepts SQL script file name parameter, xargs is not handy in this case.This is a useful use of cat:cat *.sql | mysql -u root -p dbnameAnyway, your attempt to use ls in that way leads to the famous Why you shouldn't parse the output of ls(1) article.