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 ...
随机推荐
- MOG插件(葡萄牙语,略作翻译)
这次记录下MOG大神的插件,自从我发现了这个插件,似乎开启了一个新世界诶~~~ 网址 https://atelierrgss.wordpress.com 1. MOG_YuruYuri.js CARA ...
- Yii restful api跨域
问题:NO 'Access-Control_Allow-Origin' header is present on the requested resource. 解决方案 <?php names ...
- hdu5067
题意 给了一个n*m的网格 然后一台挖掘机从(0,0) 这个位置出发,收集完全部的石头回到(0,0)挖掘机可以有无限的载重 用旅行商处理 dp[k][i] 表示在这个集合中最后到达i的最小距离,用集合 ...
- Java将对象保存到文件中/从文件中读取对象
1.保存对象到文件中 Java语言只能将实现了Serializable接口的类的对象保存到文件中,利用如下方法即可: public static void writeObjectToFile(Obje ...
- array_contains 分析函数使用演示
Hive中的array_contains函数与SQL中的 in关键字 操作类似,用于判定 包含(array_contains)或不包含(!array_contains)关系.与 in不同的是array ...
- 初探AngularJs框架(二)
一.创建Components组件 直接使用AngularCLI即可很方便的创建component组件,使用如下指令: ng g component components/news 这样就会在compo ...
- DOM jquery
DOM 文档对象模型(Document Object Model)是一种用于HTML和XML文档的编程接口.它给文档提供了一种结构化的表示方法,可以改变文档的内容和呈现方式.我们最为关心的是,DOM ...
- P1192 台阶问题
递推问题,要用到递推式: 设f(n)为n个台阶的走法总数,把n个台阶的走法分成k类:第1类:第1步走1阶,剩下还有n-1阶要走,有f(n-1)种方法: 第2类:第1步走2阶,剩下还有n-2阶要走,有f ...
- URL的解析,C语言实现
源: URL的解析,C语言实现 c语言实现urlencode和decode
- linux下nginx整合php
在nginx中药使用php可不像apache那样,因为apache是把php当做自己的一个模块来启动的, 而我们的nginx是把http请求转发给php程序,也就是说,php和nginx是相互独立的的 ...