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. C# 调用.bat 提示该命令不是内部命令或外部命令

    前提:双击.bat文件可以执行成功,用C#调用提示该命令不是内部命令或外部命令...... 解决方法:下面代码的红色标注,既要设置.bat文件的文件名FileName,也要设置.bat文件所在的文件夹 ...

  2. Jersey入门——对Json的支持

    Jersey rest接口对POJO的支持如下: package com.coshaho.learn.jersey; import java.net.URI; import javax.ws.rs.C ...

  3. Linux基础命令---杀死进程killall

    killall killall可以根据名字来杀死进程,它会给指定名字的所有进程发送信息.如果没有指定信号名,则发送SIGTERM.信号可以通过名称(例如-HUP或-SIGHUP)或数字(例如-1)或选 ...

  4. Ubuntu 为 root 帐号开启 SSH 登录

    1. 修改 root 密码sudo passwd root 2. 以其他账户登录,通过 sudo nano 修改 /etc/ssh/sshd_config :xxx@ubuntu:~$ su - ro ...

  5. 018.07 New BMW ICOM A3+B+C+D Plus EVG7 Controller Tablet PC with WIFI Function

    2018.07 New BMW ICOM A3+B+C+D Plus EVG7  Controller Tablet PC with WIFI Function Software Version : ...

  6. 案例:Redis在唯品会的大规模应用

    目前在唯品会主要负责redis/hbase的运维和开发支持工作,也参与工具开发工作,本文是在Redis中国用户组给大家分享redis cluster的生产实践. 分享大纲 本次分享内容如下: 1.生产 ...

  7. scrapy_novel_python

    # _*_ coding:UTF _8_ from bs4 import BeautifulSoup import requests,sys class downloader(object): def ...

  8. webstorm's interpreter

    下载node.js 地址:http://nodejs.cn/ next——> Node interpreter: ……/……/node.exe

  9. django 模型类的常见字段约束,以及filter 过滤和查询

    null 不设置时默认设置为False.设置为True时,数据库表字段中将存入NULL的记录. null和blank组合使用,null=True,blank=True,表示该字段可以为空 blank ...

  10. Docker学习笔记之了解 Docker 的核心组成

    0x00 概述 在掌握 Docker 的一些背景知识后,我们还不得不花费一节的篇幅来简单介绍有关 Docker 核心的一些知识.当然,大家不要觉得有“核心”这类的词,我们就要在这一节中深入 Docke ...