C#获得指定目录床架时间、更新时间和最后访问时间等信息的代码
将做工程过程常用的内容片段备份一次,下面的内容内容是关于C#获得指定目录床架时间、更新时间和最后访问时间等信息的内容,希望能对小伙伴们也有用。
using System;
using System.IO;
class MainClass {
static void Main(string[] args) {
FileInfo file = new FileInfo("c:\a.txt");
Console.WriteLine("Checking file: " + file.Name);
Console.WriteLine("File exists: " + file.Exists.ToString());
if (file.Exists) {
Console.Write("File created: ");
Console.WriteLine(file.CreationTime.ToString());
Console.Write("File last updated: ");
Console.WriteLine(file.LastWriteTime.ToString());
Console.Write("File last accessed: ");
Console.WriteLine(file.LastAccessTime.ToString());
Console.Write("File size (bytes): ");
Console.WriteLine(file.Length.ToString());
Console.Write("File attribute list: ");
Console.WriteLine(file.Attributes.ToString());
}
}
}
C#获得指定目录床架时间、更新时间和最后访问时间等信息的代码的更多相关文章
- 【转载】在Linux下,一个文件也有三种时间,分别是:访问时间、修改时间、状态改动时间
在windows下,一个文件有:创建时间.修改时间.访问时间.而在Linux下,一个文件也有三种时间,分别是:访问时间.修改时间.状态改动时间. 两者有此不同,在Linux下没有创建时间的概念,也就是 ...
- Linux下文件的三种时间标记:访问时间、修改时间、状态改动时间 (转载)
在windows下,一个文件有:创建时间.修改时间.访问时间. 而在Linux下,一个文件也有三种时间,分别是:访问时间.修改时间.状态改动时间. 两者有此不同,在Linux下没有创建时间的概念,也就 ...
- python 修改文件的创建时间、修改时间、访问时间
目录 python 修改文件创建.修改.访问时间 方案一 方案二(无法修改文件创建时间) python 修改文件创建.修改.访问时间 突如其来想知道一下 python 如何修改文件的属性(创建.修改. ...
- 使用Cookie实现显示用户上次访问时间
一. 常用Cookie API介绍 1. 获取cookie request.getCookies(); // 返回Cookie[] 2. 创建cookie Cookie(String key, St ...
- VC++ 获取文件属性创建时间、修改时间和访问时间
转载:http://blog.sina.com.cn/s/blog_66bf8d8301014ikd.html WIN32_FIND_DATA结构 关于文件的全部属性信息,总计有以下以下9 种:文件的 ...
- 一个获取指定目录下一定格式的文件名称和文件修改时间并保存为文件的python脚本
摘自:http://blog.csdn.net/forandever/article/details/5711319 一个获取指定目录下一定格式的文件名称和文件修改时间并保存为文件的python脚本 ...
- TDirectory.GetLastAccessTime获取指定目录最后访问时间
使用函数: System.IOUtils.TDirectory.GetLastAccessTime 函数定义: class function GetLastAccessTime(const Path: ...
- 运维笔记--Linux查找指定目录下某段时间的文件
查找指定目录下,60天之前的文件:find /mnt/xml_data -mtime +60 -name "*.xml" 找到并统计数量:find /mnt/xml_data -m ...
- worker 启动时向 etcd 注册自己的信息,并设置一个带 TTL 的租约,每隔一段时间更新这个 TTL,如果该 worker 挂掉了,这个 TTL 就会 expire 并删除相应的 key。
1.通过etcd中的选主机制,我们实现了服务的高可用.同时利用systemd对etcd本身进行了保活,只要etcd服务所在的机器没有宕机,进程就具备了容灾性. https://mp.weixin.qq ...
随机推荐
- [Swift]LeetCode3. 无重复字符的最长子串 | Longest Substring Without Repeating Characters
Given a string, find the length of the longest substring without repeating characters. Examples: Giv ...
- [Swift]LeetCode263. 丑数 | Ugly Number
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers ...
- [Swift]LeetCode519. 随机翻转矩阵 | Random Flip Matrix
You are given the number of rows n_rows and number of columns n_cols of a 2D binary matrix where all ...
- [Swift]LeetCode677. 键值映射 | Map Sum Pairs
Implement a MapSum class with insert, and sum methods. For the method insert, you'll be given a pair ...
- [Swift]LeetCode983. 最低票价 | Minimum Cost For Tickets
In a country popular for train travel, you have planned some train travelling one year in advance. ...
- CentOS7 Linux中通过加密grub防止黑客通过单用户系统破解root密码
如何防止别人恶意通过单用户系统破解root密码,进入系统窃取数据? 给grub加密,不让别人通过grub进入单用户. 17.3.1 基于centos6进行grub加密 [root@63 ~]# gr ...
- RedirectToAction()转移方式及参数传递
今天在做一个功能的时,使用RedirectToAction()需要从这里传几个参数,从网上查了一下,这样解决.真好. Return RedirectToAction("Index" ...
- Carousel轮播图
<div id="carousel-example-generic" class="carousel slide" data-ride="ca ...
- solr之环境配置三
配置安装Solr到Tomcat 1. 解压 solr4.7.2.zip 2. 将 solr-4.7.2\dist\solr-4.7.2.war拷贝到 apache-tomcat-7.0.55\weba ...
- 第五章 服务容错保护:Spring Cloud Hystrix
在微服务架构中,我们将系统拆分为很多个服务,各个服务之间通过注册与订阅的方式相互依赖,由于各个服务都是在各自的进程中运行,就有可能由于网络原因或者服务自身的问题导致调用故障或延迟,随着服务的积压,可能 ...