標籤:style blog http color io 使用 ar 檔案 div
1、ls -l *.sh
2、touch -d "10/13/2013" *.sh 【我想把所以的.sh檔案修改到三個月前(2013年10月13)的時間。】
3、ls -l *.sh
參考文章
http://blog.itpub.net/29283412/viewspace-1070106/
另外也可以單獨修改時間或者月份,如下
以使用 am, pm 或是 24 小時的格式,日期可以使用其他格式如 6 May 2000 。
touch -d "6:03pm" file
touch -d "05/06/2000" file touch -d "6:03pm 05/06/2000" file 以前面這一個檔案的時間去修改後面這個檔案的時間touch -r /bin/rm today 例子一:1、touch testtime32、stat testtime3 Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 153367 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-09-23 20:38:16.160006062 -0700
Modify: 2014-09-23 20:38:16.160006062 -0700
Change: 2014-09-23 20:38:16.160006062 -07003、touch -m -t 199803030504 testtime3 【變更檔的最後一次修改時間為1998-03-03】stat testtime3 File: `testtime3‘
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 153367 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-09-23 20:38:16.160006062 -0700
Modify: 1998-03-03 05:04:00.000000000 -0800 【只有這裡有改變】
Change: 2014-09-23 20:39:30.670005854 -07004、 touch -a -t 199803030504 testtime3stat testtime3 File: `testtime3‘
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 802h/2050d Inode: 153367 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 1998-03-03 05:04:00.000000000 -0800 【只有這裡有改變】
Modify: 1998-03-03 05:04:00.000000000 -0800
Change: 2014-09-23 20:40:01.014005560 -0700【註:已測。如果是這樣touch -t 199903030504 testtime4。Access time 和Modify time都改變了,Change time不改變】 參考文獻:http://blog.sina.com.cn/s/blog_6c9d65a10100msfy.html
linux 修改檔案時間