int ScanDir(QDir *directory, QString filemask, QSqlQuery *query){ QDir dir(directory->absolutePath()); dir.setFilter( QDir::Files | QDir::Readable | QDir::AllDirs | QDir::NoDotAndDotDot ); QFileInfoList list = dir.entryInfoList(QDir::nameFiltersFromString(filemask)); for (int i=0; i<(list.count());i++) { if (list.at(i).isFile()) { ScanFile(list.at(i).absoluteFilePath(), query); } else { QDir new_path(list.at(i).absoluteFilePath()); ScanDir(&new_path, filemask, query); } }return 0;}
QSqlQuery query;[... код создания таблиц...] QString filemask; filemask = argv[1]; QDir dir(argv[param_index]); dir.setPath(dir.absolutePath()); if (dir.exists()) { // Сканируем указанную директорию, учитывая маску ScanDir(&dir, filemask, &query); }
QString dir(QFileDialog::getExistingDirectory(this, tr("Select Directory"), HomeDir.absolutePath(), QFileDialog::ShowDirsOnly)); if (!dir.isEmpty()) { QProcess *proc = new QProcess(); QString findproc("./find2db"); QStringList findparam; QString mask("\"*\""); findparam << mask << dir; proc->start(findproc, findparam); }
C++ (Qt)QString dir(QFileDialog::getExistingDirectory(this, tr("Select Directory"), HomeDir.absolutePath(), QFileDialog::ShowDirsOnly)); if (!dir.isEmpty()) { QProcess *proc = new QProcess(); QString findproc("sh"); QStringList findparam; QString mask("\"*\""); findparam << "./find2db" << mask << dir; proc->start(findproc, findparam); }
#include <QtCore/QCoreApplication>#include <QDebug>int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); qDebug() << argv[0] << argv[1] << argv[2]; return a.exec();}