修改文件修改时间的东西
2008-05-30 10:03
281 查看
#include "stdafx.h"
#include "windows.h"
#include "iostream.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
if (argc == 8)
{
FILETIME ft,ft1;
SYSTEMTIME systime;
int gxm,gxm1,gxm2,gxm3,gxm4,gxm5;
gxm=atoi(argv[7]);
gxm=gxm - 1;
gxm1=atoi(argv[2]);
gxm2=atoi(argv[3]);
gxm3=atoi(argv[4]);
gxm4=atoi(argv[5]);
gxm5=atoi(argv[6]);
systime.wYear = gxm1;
systime.wMonth = gxm2;
systime.wDay = gxm3;
systime.wHour = gxm4;
systime.wMinute = gxm5;
systime.wSecond = gxm; //想要改变秒,必须要少一位
SystemTimeToFileTime(&systime, &ft);
LocalFileTimeToFileTime(&ft,&ft1); //把时间转换UTC
HANDLE hFile;
hFile = CreateFile(argv[1], GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ| FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile== INVALID_HANDLE_VALUE)
{
printf("open't the file[!]...................................error/n");
}
SetFileTime(hFile, (LPFILETIME) NULL, (LPFILETIME) NULL, &ft1);
CloseHandle(hFile);
printf("changed[!]...................................OK/n");
return 0;
}
printf("GXM修改文件最后修改日期工具/n");
cout << "文件使用方法为:"<<endl;
cout << "/t" << argv[0] << " path year month Day Hour Minute Second"<<endl;
return 0;
}
#include "windows.h"
#include "iostream.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
if (argc == 8)
{
FILETIME ft,ft1;
SYSTEMTIME systime;
int gxm,gxm1,gxm2,gxm3,gxm4,gxm5;
gxm=atoi(argv[7]);
gxm=gxm - 1;
gxm1=atoi(argv[2]);
gxm2=atoi(argv[3]);
gxm3=atoi(argv[4]);
gxm4=atoi(argv[5]);
gxm5=atoi(argv[6]);
systime.wYear = gxm1;
systime.wMonth = gxm2;
systime.wDay = gxm3;
systime.wHour = gxm4;
systime.wMinute = gxm5;
systime.wSecond = gxm; //想要改变秒,必须要少一位
SystemTimeToFileTime(&systime, &ft);
LocalFileTimeToFileTime(&ft,&ft1); //把时间转换UTC
HANDLE hFile;
hFile = CreateFile(argv[1], GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ| FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile== INVALID_HANDLE_VALUE)
{
printf("open't the file[!]...................................error/n");
}
SetFileTime(hFile, (LPFILETIME) NULL, (LPFILETIME) NULL, &ft1);
CloseHandle(hFile);
printf("changed[!]...................................OK/n");
return 0;
}
printf("GXM修改文件最后修改日期工具/n");
cout << "文件使用方法为:"<<endl;
cout << "/t" << argv[0] << " path year month Day Hour Minute Second"<<endl;
return 0;
}
相关文章推荐
- [无聊]发个修改文件创建/修改/访问时间的东西
- Android 为【apk】文件签名,增加修改系统时间等权限
- 使用golang获取linux上文件的访问/创建/修改时间
- 用 C# 轻松读取、改变文件的创建、修改、访问时间 .
- C#/.NET读取或修改文件的创建时间及修改时间详解
- Centos下使用find命令之查找指定时间内修改过的文件
- 在Linux下,一个文件也有三种时间,分别是:访问时间、修改时间、状态改动时间
- Python实现查询某个目录下修改时间最新的文件示例
- 修改文件的访问时间和修改时间为当前的时间
- Java实现修改文件时间
- LINUX C++ 按修改时间清理过期文件函数实现
- make: *** 警告:文件“ManyDialog.pro”的修改时间在将来9.1e+04
- delphi 获取文件创建,修改时间
- 文件创建时间、访问时间、修改时间
- asp.net 获得文件属性中的修改时间,获得系统文件属性的方法,最后一次写入时间
- linux 文件时间查看及修改
- 织梦DEDECMS缓存文件时间长度的修改方法
- pshell修改文件创建时间
- 在Delphi中获取和修改文件的时间
- 修改文件时间与创建新文件:touch