void GetCapNum(int * todayNum, int * mouthNum) {
    string path = ".\\res";//路径位于程序运行目录下的res文件夹里面
    string exd = "png";//提取png后缀名的文件
    //文件句柄
    long   hFile = 0;
    //文件信息
    struct _finddata_t fileinfo;
    string pathName, exdName;
    if (0 != strcmp(exd.c_str(), ""))
    {
        exdName = "\\face*." + exd;//所有face*.png的文件 如果是\\*.png 就是所有的png文件
    }
    else
    {
        exdName = "\\face*";//所有face*.png的文件  如果是\\*.png 就是所有的png文件
    }

printf("get current  time %s\n" , pathName.assign(path).append(exdName).c_str());

if ((hFile = _findfirst(pathName.assign(path).append(exdName).c_str(), &fileinfo)) != -1)
    {
        //获取当前时间
        time_t* mptr_currentSeconds = new time_t;
        time(mptr_currentSeconds);
        struct tm*  m_localTime = localtime(mptr_currentSeconds);
        printf("current Local time : %d:%d:%d\n", m_localTime->tm_hour, m_localTime->tm_min, m_localTime->tm_sec);

do
        {
            //如果是文件夹中仍有文件夹,迭代之
            //如果不是,加入列表
            /**
            if ((fileinfo.attrib &  _A_SUBDIR))
            {
            if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
            getFiles(pathName.assign(path).append("\\").append(fileinfo.name), exd, files);
            }
            else
            {**/

if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) {
                HANDLE    picFile = 0;
                FILETIME ftCreate, ftAccess, ftWrite;
                SYSTEMTIME createTimeUTC, createTimeLocal;

//files.push_back(pathName.assign(path).append("\\").append(fileinfo.name));

string picpath = ".\\res\\";
                picpath = picpath.append(fileinfo.name);
                char *pth = (char *)picpath.data();
                //获取图片的创建时间
                printf("CreateFile %s \n",pth);
                //picFile = CreateFile("D:\\dev\\fmt\\res\\face1.png", 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
                picFile = CreateFile(pth, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

if (INVALID_HANDLE_VALUE == picFile) {
                    printf("CreateFile error: %d", GetLastError());
                    continue;
                    //ExitProcess(0);
                }
                GetFileTime(picFile, &ftCreate, &ftAccess, &ftWrite);
                FileTimeToSystemTime(&ftCreate, &createTimeUTC);
                SystemTimeToTzSpecificLocalTime(NULL, &createTimeUTC, &createTimeLocal);
                printf("创建时间:\t%02d/%02d/%d  %02d:%02d \n",
                    createTimeLocal.wDay, createTimeLocal.wMonth, createTimeLocal.wYear,
                    createTimeLocal.wHour, createTimeLocal.wMinute);
                if ((createTimeLocal.wDay == m_localTime->tm_yday) && (createTimeLocal.wMonth == m_localTime->tm_mon) && (createTimeLocal.wYear == m_localTime->tm_year)) {
                    *todayNum = *todayNum + 1;
                }
                *mouthNum = *mouthNum + 1;
            }
            //}
        } while (_findnext(hFile, &fileinfo) == 0);
        _findclose(hFile);
    }

}

VC++ 统计文件夹下面的当日和本月生成的图片的更多相关文章

  1. 统计文件夹下java代码行数的小程序--主要是学习任务队列的思想

    首先感谢czbk的老师,录制的视频,让我们有这么好的学习资料.……—— 统计文件夹java文件的行数,首先想到的肯定是用递归的方法,因为文件夹下面可能包含文件夹,用递归的方法,代码容易写.(这和写简单 ...

  2. python (9)统计文件夹下的所有文件夹数目、统计文件夹下所有文件数目、遍历文件夹下的文件

    命令:os 用到的:os.walk   os.listdir 写的爬虫爬的数据,但是又不知道进行到哪了,于是就写了个脚本来统计文件的个数 #统计 /home/dir/ 下的文件夹个数 import o ...

  3. Linux统计文件夹下文件信息

    统计当前文件夹里面有多少文件,即统计文件个数 ls -l |grep "^-"|wc -l 统计当前文件夹里面有多少文件夹,即统计文件夹个数 ls -l |grep "^ ...

  4. linux统计文件夹大小

    统计总大小: du -sh dirname 统计文件夹内部各文件大小及总大小: du -h dirname

  5. Linux上统计文件夹下文件个数以及目录个数

    对于linux终端用户而言,统计文件夹下文件的多少是经常要做的操作,于我而言,我会经常在谷歌搜索一个命令,“如何在linux统计文件夹的个数”,然后点击自己想要的答案,但是有时候不知道统计文件夹命令运 ...

  6. AJPFX:实现递归统计文件夹的总大小

    class Statistical {    public static void main(String[] args) {        Scanner sc = new Scanner(Syst ...

  7. Linux 统计文件夹下文件个数及目录个数

    1. 统计文件夹下文件的个数 ls -l | grep "^-" | wc -l 2.统计文件夹下目录的个数 ls -l | grep "^d" | wc -l ...

  8. ls命名 | Linux统计文件夹内的文件个数

    ls命名 man ls -R 递归列出全部的目录内容 recusive -a 列出所有的文件(包括以 . 开头的隐藏文件) all -r 逆序排列 reverse -t 按照时间信息排序 time - ...

  9. linux 统计文件夹下文件,文件夹,所有个数

    统计某文件夹下文件的个数 ls -l |grep "^-"|wc -l 统计某文件夹下目录的个数 ls -l |grep "^d"|wc -l 统计文件夹下文件 ...

随机推荐

  1. BZOJ 3929 Circle of digits 解题报告

    首先,我们可以得到最高位的位数为:\(\lfloor\frac{n+k-1}{n}\rfloor\),记作 \(E\). 然后给这 \(n\) 个长为 \(E\) 的数字排序,后缀数组 \(O((n+ ...

  2. about backbone

    http://presentation.tiddr.de/backbone-presentation/introduction/index.html#Further%20issues http://m ...

  3. Android ListView(Selector 背景图片)

    listview0.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmln ...

  4. 浅谈HTTP中Get与Post的区别/HTTP协议与HTML表单(再谈GET与POST的区别)

    HTTP协议与HTML表单(再谈GET与POST的区别) GET方式在request-line中传送数据:POST方式在request-line及request-body中均可以传送数据. http: ...

  5. ASP.NET控件Button (e.CommandArgument的使用方法)

    e.CommandArgument的使用方法 1. 在 Web 窗体页上显示普通按钮 (Button) 控件. <asp:Button id="MyButton" Text= ...

  6. Emmet(前身是zen coding)介绍和使用

    Zen coding - 一种快速编写HTML/CSS代码的方法.它使用仿CSS选择器的语法来快速开发HTML和CSS - 由Sergey Chikuyonok开发. 现在它改名为了Emmet,并且搭 ...

  7. 【DataStructure In Python】Python模拟链表

    最近一直在学习Python和Perl这两门语言,两者共同点很多,也有不多.希望通过这样的模拟练习可以让自己更熟悉语言,虽然很多时候觉得这样用Python或者Perl并没有体现这两者的真正价值. #! ...

  8. git push origin master、git pull出现如下错误

    git push origin master出现如下错误: Counting objects: , done. Writing objects: % (/), bytes, done. Total ( ...

  9. easyui datagrid plunges 扩展 插件

      项目使用 springmvc4.x  spring4.x  hibernate4.x easyui 为了便于开发,扩展了easyui 的 datagrid 功能,下面直接贴上扩展代码: /** * ...

  10. c程序设计语言_习题1-19_编写函数reverse(s)将字符串s中字符顺序颠倒过来。

    Write a function reverse(s) that reverses the character string s . Use it to write a program that re ...