例用C# 变更文件夹时间
// This sample shows the differences between dates from methods that use //coordinated universal time (UTC) format and those that do not. using System; using System.IO; namespace IOSamples {public class DirectoryUTCTime{public static void Main(){// Set the directory.string n = @"C:\test\newdir";//Create two variables to use to set the time.DateTime dtime1 = new DateTime(2002, 1, 3);DateTime dtime2 = new DateTime(1999, 1, 1);//Create the directory.try{Directory.CreateDirectory(n);}catch (IOException e){Console.WriteLine(e);}//Set the creation and last access times to a variable DateTime value.Directory.SetCreationTime(n, dtime1);Directory.SetLastAccessTimeUtc(n, dtime1);// Print to console the results.Console.WriteLine("Creation Date: {0}", Directory.GetCreationTime(n));Console.WriteLine("UTC creation Date: {0}", Directory.GetCreationTimeUtc(n));Console.WriteLine("Last write time: {0}", Directory.GetLastWriteTime(n));Console.WriteLine("UTC last write time: {0}", Directory.GetLastWriteTimeUtc(n));Console.WriteLine("Last access time: {0}", Directory.GetLastAccessTime(n));Console.WriteLine("UTC last access time: {0}", Directory.GetLastAccessTimeUtc(n));//Set the last write time to a different value.Directory.SetLastWriteTimeUtc(n, dtime2);Console.WriteLine("Changed last write time: {0}", Directory.GetLastWriteTimeUtc(n));}} } // Obviously, since this sample deals with dates and times, the output will vary // depending on when you run the executable. Here is one example of the output: //Creation Date: 1/3/2002 12:00:00 AM //UTC creation Date: 1/3/2002 8:00:00 AM //Last write time: 12/31/1998 4:00:00 PM //UTC last write time: 1/1/1999 12:00:00 AM //Last access time: 1/2/2002 4:00:00 PM //UTC last access time: 1/3/2002 12:00:00 AM //Changed last write time: 1/1/1999 12:00:00 AM
例用C# 变更文件夹时间相关推荐
- 一定要时常清理QQ的七个文件夹(时间长占内存超大!)
QQ用户请注意了,这5个文件夹要定时清理! 提升内存 安装目录\ProgramFiles\Tencent\QQ\ad 这里面是QQ广告,删掉! 安装目录\ProgramFiles\Tencent\QQ ...
- c语言 获取文件修改时间,(C语言)获取并修改文件夹时间(创建时间、修改时间、访问时间)...
背景 在Windows系统下没有提供可以对文件夹时间属性修改的方法或者API,在上一篇文章中我们提到了文件时间的函数,那么我们可以以打开文件的方式打开文件夹,然后通过修改文件时间的API函数对文件夹时 ...
- python3单例-python3如何运行文件夹python单例模式
单例模式是一种常用的软件设计模式. 在单例模式的核心结构中,只包含一个被称为单例类的特殊类. 通过单例模式可以保证系统中一个类只有一个实例,而且这个实例可以轻易被外界访问,方便控制实例对象的个数以节约 ...
- linux更改文件夹权限_Linux 一些重点知识,整理的很全面,有必要收藏
我们都知道Linux是一个多用户,多任务的系统.这也是它的最优秀的特性,也就是说,可能有很多人同时在系统上工作,因此请不要强行关机. 同时,为了保护每个人的隐私和工作环境,对于某个文档(文件,目录), ...
- php实现文件夹管理器,php实现文件管理与基础功能操作
文件的基本操作 先来看一下PHP文件基础操作,请看强大注释 var_dump(filetype("./img/11.png")); //判断返回得是文件还是目录,返回sile为文件 ...
- 合并文件夹中子目录_如何整理文件夹,看这一篇就够了,简单易学
说出来可能你们不信,松鼠君在办公室看到了人类第八大奇迹-- 一个全是新建文件夹的电脑! 我的乖乖,他到底是怎么干活的 层级分类 在我们日常的工作生活中,对电脑的文件进行整理成了不可避免的工作:而如何高 ...
- sudo修改文件夹名字_linux
Linux下快速批量修改文件夹下的图片名称的方法 Linux下快速批量修改文件夹下的图片名称的方法 我们都知道,要修改文件夹下的图片名称很容易,但是要批量修改就比较浪费时间了,那么有什么方法能够快速批 ...
- php实现浏览文件夹按钮,php实现文件管理与基础功能操作
php实现文件管理与基础功能操作2020-06-17 11:59:15 文件的基本操作 先来看一下PHP文件基础操作,请看强大注释 var_dump(filetype("./img/11.p ...
- os 修改文件夹 名_如何在OS X中更改文件夹和应用程序图标
os 修改文件夹 名 One of the best ways to customize your Mac and make it your own is to change your app and ...
最新文章
- 独家 | 关于NLP和机器学习之文本处理的你需要知道的一切(附学习资源)
- python 字典的系列操作
- Android中使用AlarmManager设置闹钟
- Android studio 使用Gradle发布Android开源项目到JCenter 总结
- Google AdSense 帐户已被停用
- 机器学习实验中的编程技术(part2)--numpy
- wxpython富文本_去除富文本编辑器中的标签
- b/s模式的服务器性能监控系统,基于B/S模式的PC监控系统及方法
- UVA10375 POJ2613 ZOJ1863 Choose and divide【组合计算+迭代】
- origin下载速度慢 解决方法
- 高精度乘法———列表法
- html实现图片裁剪,【前端】图片裁剪(二)Jcrop实现裁剪
- [C语言] [游戏] 扫雷
- linux常用命令整理(详细)
- HTML语言剖析15:调色原理
- chatter命令详解(用来记录知识)
- The Easter Proclamation (Exsultet) / 逾越颂
- 转载和积累系列 - linux 生成KEY的方法与使用
- 今日头条各种套路玩法
- 如何修改tomcat默认的8080端口号
热门文章
- 《Java8实战》笔记(06):用流收集数据
- C++中size_type类型详解
- 内存不足:杀死进程还是牺牲子进程
- 解决:无法获取实体类com.xxx.xx.xx.xx.dto.XxxDTO对应的表名
- oracle中rownum和row_number()的区别
- mysql多条数据合并一条之后取出重复值
- Visual Studio.net 2010 Windows Service 开发,安装与调试
- DELPHI之常用函数
- 终于用上gcc-4.1编译的系统了
- .NET高级代码审计(第三课)Fastjson反序列化漏洞