cli: commanddelete: fix broken dry-run
This commit is contained in:
parent
021722b090
commit
ec1219acda
@ -17,34 +17,34 @@ int CommandDelete::removeNonExistent(bool verbose, bool dryRun, QString pattern)
|
|||||||
{
|
{
|
||||||
for(FileData &file : files)
|
for(FileData &file : files)
|
||||||
{
|
{
|
||||||
if(!dryRun)
|
|
||||||
{
|
|
||||||
QFileInfo fileInfo(file.absPath);
|
QFileInfo fileInfo(file.absPath);
|
||||||
if(!fileInfo.exists())
|
if(!fileInfo.exists())
|
||||||
{
|
{
|
||||||
if(this->dbService->deleteFile(file.absPath))
|
if(!dryRun)
|
||||||
{
|
{
|
||||||
if(verbose)
|
if(this->dbService->deleteFile(file.absPath))
|
||||||
{
|
{
|
||||||
Logger::info() << "Deleted" << file.absPath << endl;
|
if(verbose)
|
||||||
|
{
|
||||||
|
Logger::info() << "Deleted" << file.absPath << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger::error()<< "Failed to delete:" << file.absPath << ", exiting." << endl
|
||||||
|
;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger::error()<< "Failed to delete:" << file.absPath << ", exiting." << endl
|
Logger::info() << "Would delete " << file.absPath << endl;
|
||||||
;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger::info() << "Would delete " << file.absPath << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += limit;
|
offset += limit;
|
||||||
processedRows = this->dbService->getFiles(files, pattern, 0, limit);
|
processedRows = this->dbService->getFiles(files, pattern, offset, limit);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user