Print a file's last modified date in Bash
date -r <filename>
#!/usr/bin/env bash
for i in /var/log/*.out; do
stat -f "%Sm" -t "%Y-%m-%d %H:%M" "$i"
echo "$i"
done
echo "Please type in the directory you want all the files to be listed with last modified dates" #bash can't find file creation dates
read directory
for entry in "$directory"/*
do
modDate=$(stat -c %y "$entry") #%y = last modified. Qoutes are needed otherwise spaces in file name with give error of "no such file"
modDate=${modDate%% *} #%% takes off everything off the string after the date to make it look pretty
echo $entry:$modDate
REF:
https://stackoverflow.com/questions/16391208/print-a-files-last-modified-date-in-bash
Print a file's last modified date in Bash的更多相关文章
- 解决SharePoint 文档库itemadded eventhandler导致的上传完成后,编辑页面保持报错的问题,错误信息为“该文档已经被编辑过 the file has been modified by...”
在文档库中添加itemadded 后,在上传文件后,会自动打开文档属性的编辑页面,在保存的时候就会报错,说这个文档已经被编辑过了.这是应为默认itemadded实践是异步执行的,会在edit页面打开之 ...
- WEB-INF目录下文件复制的几种方式
2018年1月31日 10:42:55 工作完写点博客记录下. 需求:从web-inf下拷贝文件到指定目录. 目录结构 直接贴代码 第一种方式,字节流读取 try { int index = 0; S ...
- R语言:R2OpenBUGS
R语言:R2OpenBUGS 用这个包调用BUGS model,分别用表格和图形概述inference和convergence,保存估计的结果 as.bugs.array 转换成bugs object ...
- webkit在vs2008中编译
转载自:http://xjchilli.blog.163.com/blog/static/4534773920091016115533158/ webkit的官方网站写的webkit需要在vs2005 ...
- 15 Basic ‘ls’ Command Examples in Linux
FROM: http://www.tecmint.com/15-basic-ls-command-examples-in-linux/ ls command is one of the most fr ...
- Java中的File操作总结
1.创建文件 import java.io.File; import java.io.IOException; public class CreateFileExample { public stat ...
- swat主流域文件(file.cio)参数详解——引自http://blog.sciencenet.cn/blog-922140-710636.html
% file.clo,即主流域文件用于文件管理,包括与模型选项.气候输入.数据库和输出控制相关的信息. Master Watershed File: file.cio Project Descript ...
- 查找EBS中各种文件版本(Finding File Versions in the Oracle Applications EBusiness Suite - Checking the $HEADER)
Finding File Versions in the Oracle Applications EBusiness Suite - Checking the $HEADER (文档 ID 85895 ...
- Python3基础 file seek 将文件的指针恢复到初始位置
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
随机推荐
- python -- 判断给定的参数是否是地理位置的经度和纬度
例子: coordinates = "2.3,-8ui" 无效地理位置 coordinates = "2.3,-8i" 有效地理位置 方法一:使用try...e ...
- php实现多进程
转:http://www.jb51.net/article/71238.htm cd php-version/ext/pcntl phpize ./configure && make ...
- 加载MySQL、Oracle、SQL Server 2000、SQL Server 2005及以上版本 的加载数据库驱动程序
2018-11-04 20:00:59 开始 //getConnection(String url, String user, String password) //url:连接数据库的URL 3 ...
- 【Elasticsearch学习之一】Elasticsearch
环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 jdk8 一.概念ElasticSearch: 基于Lucene全文搜 ...
- wingide 远程调试
1.首先你应该在本地安装wingide 6.1版本 2.大多数电脑.py文件都不能以wingide的形式打开(异常苦逼),无论是从“属性”或者是“设置”里面都不可以,无奈之下只能通过修改注册表的方式进 ...
- Beta分布深入理解
一些公式 Gamma函数 (1) 贝叶斯公式 (2) 贝叶斯公式计算二项分布概率 现在有一枚未知硬币,我们想要计算抛出后出现正面的概率.我们使用贝叶斯公式计算硬币出现正面的概率.硬币出现正反率的概率和 ...
- 【函数封装】javascript判断移动端操作系统为android 或 ios 或 iphoneX
function isPhone(){ var u = navigator.userAgent, app = navigator.appVersion; var isAndroid = u.index ...
- tensorflow学习5----变量管理
---恢复内容开始--- 前面,读书笔记用加入正则化损失模型效果带来的提升要相对显著. 变量管理: 目的:当神经网络的结构更加复杂,参数更多的时候,就需要一个更好的方式来管理神经网络中的参数. 解决方 ...
- XmlDocument操作
一.基本操作:XmlDocument 写 class Program { static void Main(string[] args) { // 使用DOM操作,常用的类:XmlDocument.X ...
- ASP.NET Core Web API 索引 (更新Redis in .NET Core)
https://www.cnblogs.com/cgzl/p/9178672.html