posix - How to get file name which is last created and starts with word "backup"? -


how file name last created , starts word "backup" ? have listed directory

dir *dir; struct dirent *ent; if ((dir = opendir (directory.c_str())) != null) {   while ((ent = readdir (dir)) != null) {     string name(ent->d_name);   }   closedir (dir); } else {   /* not open directory */   perror ("");   return "exit_failure"; } 

but how metadata when created ?

you can use stat lots of information file. output of stat struct stat. struct stat contains following member data:

           struct timespec st_atim;  /* time of last access */            struct timespec st_mtim;  /* time of last modification */            struct timespec st_ctim;  /* time of last status change */ 

is enough needs?

more information on stat can found in its man page.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -