#include <QCoreApplication>
#include <QFileInfo>
#include <QDebug>
#include <QDateTime>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QString filename ="D:/OpenGIS/osg+Obliquephoto/1JC/11JC.s3c";
if (filename.isEmpty())
return 1;
QFileInfo fileInfo(filename);
qDebug() << fileInfo.suffix(); //后缀 s3c
qDebug() << fileInfo.baseName(); //11JC
qDebug() << fileInfo.fileName(); //文件名 "11JC.s3c"
QFileInfo fi("/tmp/archive.tar.gz");
qDebug() << fi.completeSuffix(); // "tar.gz"
qDebug() << fi.completeBaseName(); //"archive.tar"
qDebug() << fileInfo.created(); //创建时间 QDateTime(2017-10-31 14:09:37.310 中国标准时间 Qt::TimeSpec(LocalTime))
qDebug() << fileInfo.exists() ; //true
qDebug() << fileInfo.lastRead() ; //最后读取时间 QDateTime(2018-03-08 20:42:41.385 中国标准时间 Qt::TimeSpec(LocalTime))
qDebug() << fileInfo.owner() ;
qDebug() << fileInfo.size() ; //文件大小5947
qDebug() << fileInfo.absoluteFilePath(); //str = D:/OpenGIS/osg+Obliquephoto/1JC/11JC.s3c
qDebug() << fileInfo.canonicalPath(); //str = D:/OpenGIS/osg+Obliquephoto/1JC
qDebug() << fileInfo.absolutePath(); //str = D:/OpenGIS/osg+Obliquephoto/1JC
qDebug() << fileInfo.path(); //"D:/OpenGIS/osg+Obliquephoto/1JC"
qDebug() << fileInfo.filePath(); //"D:/OpenGIS/osg+Obliquephoto/1JC/11JC.s3c"
return a.exec();
}