void CleanFiles() { //DBGLOG("directory len %d and ext len: %d",Directory.length(),Ext.length()); if (Directory.length() == 0 || Ext.length() == 0) return; CDateTime currentTime; currentTime.setNow(); int fileCounter = 0; // DBGLOG("Directory:%s for files of ext:%s",Directory.str(), Ext.str()); Owned<IDirectoryIterator> di = createDirectoryIterator(Directory.str(), Ext.str()); ForEach (*di) { IFile &file = di->query(); CDateTime createTime, modifiedTime,accessedTime; file.getTime( &createTime, &modifiedTime, &accessedTime); StringBuffer accessedTimeStr,currentTimeStr; accessedTime.getString(accessedTimeStr); accessedTime.adjustTime(+m_CacheTimeoutPeriod); accessedTimeStr.clear(); accessedTime.getString(accessedTimeStr); currentTime.getString(currentTimeStr); if (accessedTime.compare(currentTime) < 0) { const char* fileName = file.queryFilename(); DBGLOG("Trying to remove:%s",fileName); if (file.exists() == true) { fileCounter++; bool bDeleteOk = file.remove(); if (!bDeleteOk) WARNLOG("ERROR Removing old cache file %s",fileName); } } } }
bool processArgvFilename(IFileArray & filenames, const char * filename) { if (filename[0] == '@') return processArgvFilenamesFromFile(filenames, filename+1); if (containsFileWildcard(filename)) { StringBuffer dirPath, dirWildcard; splitFilename(filename, &dirPath, &dirPath, &dirWildcard, &dirWildcard); Owned<IDirectoryIterator> iter = createDirectoryIterator(dirPath.str(), dirWildcard.str()); ForEach(*iter) { IFile & cur = iter->query(); if (cur.isFile() == foundYes) filenames.append(OLINK(cur)); } } else {
void expandManifestDirectory(IPropertyTree *manifestSrc, IPropertyTree &res, StringBuffer &dir, const char *path, const char*mask, bool recursive) { Owned<IDirectoryIterator> it = createDirectoryIterator(path, mask); expandManifestDirectory(manifestSrc, res, dir, it, mask, recursive); }
void ResourceManifest::expandDirectory(IPropertyTree &res, const char *path, const char*mask, bool recursive) { Owned<IDirectoryIterator> it = createDirectoryIterator(path, mask); expandDirectory(res, it, mask, recursive); }