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的更多相关文章

  1. 解决SharePoint 文档库itemadded eventhandler导致的上传完成后,编辑页面保持报错的问题,错误信息为“该文档已经被编辑过 the file has been modified by...”

    在文档库中添加itemadded 后,在上传文件后,会自动打开文档属性的编辑页面,在保存的时候就会报错,说这个文档已经被编辑过了.这是应为默认itemadded实践是异步执行的,会在edit页面打开之 ...

  2. WEB-INF目录下文件复制的几种方式

    2018年1月31日 10:42:55 工作完写点博客记录下. 需求:从web-inf下拷贝文件到指定目录. 目录结构 直接贴代码 第一种方式,字节流读取 try { int index = 0; S ...

  3. R语言:R2OpenBUGS

    R语言:R2OpenBUGS 用这个包调用BUGS model,分别用表格和图形概述inference和convergence,保存估计的结果 as.bugs.array 转换成bugs object ...

  4. webkit在vs2008中编译

    转载自:http://xjchilli.blog.163.com/blog/static/4534773920091016115533158/ webkit的官方网站写的webkit需要在vs2005 ...

  5. 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 ...

  6. Java中的File操作总结

    1.创建文件 import java.io.File; import java.io.IOException; public class CreateFileExample { public stat ...

  7. swat主流域文件(file.cio)参数详解——引自http://blog.sciencenet.cn/blog-922140-710636.html

    % file.clo,即主流域文件用于文件管理,包括与模型选项.气候输入.数据库和输出控制相关的信息. Master Watershed File: file.cio Project Descript ...

  8. 查找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 ...

  9. Python3基础 file seek 将文件的指针恢复到初始位置

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

随机推荐

  1. 强化学习--Actor-Critic---tensorflow实现

    完整代码:https://github.com/zle1992/Reinforcement_Learning_Game Policy Gradient  可以直接预测出动作,也可以预测连续动作,但是无 ...

  2. Windows 下VC++6.0制作、使用动态库和静态库

    Windows 下VC++6.0制作.使用动态库和静态库 一.VC++6.0制作.使用静态库 静态库制作 1.如图一在VC++6.0中new一个的为win32 static library工程并新建一 ...

  3. 关于ajax原理介绍

    1.ajax技术的背景 不可否认,ajax技术的流行得益于google的大力推广,正是由于google earth.google suggest以及gmail等对ajax技术的广泛应用,催生了ajax ...

  4. highcharts插件

    详见官网:https://www.highcharts.com.cn/demo/highcharts 详细使用代码: <!DOCTYPE html> <html lang=" ...

  5. CentOS7使用yum命令安装Java1.8

    CentOS7使用yum命令安装Java1.8 首先更新已安装的包:#yum update查看系统当前的java版本:#java -version==================== CentOS ...

  6. Kali linux apt-get update 失败,无release……(最有效)

    设置源 编辑 /etc/apt/sources.list nano /etc/apt/sources.list 清空文件内所有内容后添加 deb http://mirrors.ustc.edu.cn/ ...

  7. django模型中的关系对应

    显然,关系数据库的力量在于将表相互关联.Django提供了定义三种最常见的数据库关系类型的方法:多对一,多对多和一对一. 在说明之前,首先来理解一下这三个概念: 多对一: 两个集合a,b;集合a中的多 ...

  8. Centos环境自写脚本查看使用php或nginx占用内存

    在CentOs6.4下,用root权限测试. # cd ~ //进入home目录 # vim .bashrc //编辑文件,把下面代码放入地址 mem () { top -n1 -b | head - ...

  9. P3804 【模板】后缀自动机

    P3804 [模板]后缀自动机 后缀自动机模板 详情可见luogu题解板块 #include<iostream> #include<cstdio> #include<cs ...

  10. [VS] - "包含了重复的“Content”项。.NET SDK 默认情况下包括你项目中的“Content”项。

    copy to :http://www.cnblogs.com/jinzesudawei/p/7376916.html VS 2017 升级至  VS 2017 v15.3 后,.Net Core 1 ...