Man touch [BSD...MacOS X] コマンドメモ


ファイル、フォルダのタイムスタンプを書き換える touch

touch -t 201502080833 FILE0373.MOV ... MacOS X/BSD
または
touch -t "201502080833" FILE0373.MOV
カメラの日付がリセットされていたので撮影時刻をかえることが目的。

touchの説明 ... MacOS X 10.6.8

$ man touch.txt
TOUCH(1) BSD General Commands Manual TOUCH(1)

NAME
touch -- change file access and modification times

SYNOPSIS
touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...

DESCRIPTION
The touch utility sets the modification and access times of files to the
current time of day. If the file doesn't exist, it is created with
default permissions.

The following options are available:

-a Change the access time of the file. The modification time of the
file is not changed unless the -m flag is also specified.

-c Do not create the file if it does not exist. The touch utility
does not treat this as an error. No error messages are displayed
and the exit value is not affected.

-f Attempt to force the update, even if the file permissions do not
currently permit it.

-m Change the modification time of the file. The access time of the
file is not changed unless the -a flag is also specified.

-r Use the access and modifications times from the specified file
instead of the current time of day.

-t Change the access and modification times to the specified time.
The argument should be in the form ``[[CC]YY]MMDDhhmm[.SS]''
where each pair of letters represents the following:

CC The first two digits of the year (the century).
YY The second two digits of the year. If ``YY'' is
specified, but ``CC'' is not, a value for ``YY''
between 69 and 99 results in a ``CC'' value of 19.
Otherwise, a ``CC'' value of 20 is used.
MM The month of the year, from 1 to 12.
DD the day of the month, from 1 to 31.
hh The hour of the day, from 0 to 23.
mm The minute of the hour, from 0 to 59.
SS The second of the minute, from 0 to 61.

If the ``CC'' and ``YY'' letter pairs are not specified, the val-
ues default to the current year. If the ``SS'' letter pair is
not specified, the value defaults to 0.
........
BSD April 28, 1995 BSD

Ls コマンド ... MacOS Xと Linux

$ ll
total 608
drwxr-xr-x 4 suger staff 136 5 5 2014 Applications
drwx------ 6 suger staff 204 2 4 12:22 Desktop
-rw-r--r--@ 1 root staff 1024 10 21 2010 Desktop DB
-rw-r--r--@ 1 root staff 2 10 21 2010 Desktop DF
........
drwx------ 11 suger staff 374 1 25 16:22 Pictures
drwxr-xr-x 6 suger staff 204 5 12 2011 Public

"ll" は以下で指定している。
$ cat .bashrc
alias ll='ls -l'

タイムスタンプを詳細表示するには ... Linux

$ ls -l
total 32
drwxr-xr-x 2 user1 user1 4096 Sep 10 2010 Mail
drwxr-xr-x 5 user1 user1 4096 Oct 12 2010 Maildir
-rw-rw-r-- 1 user1 user1 9681 Feb 8 13:03 ls.txt
drwxr-xr-x 5 user1 user1 4096 Mar 14 2014 work
drwxr-xr-x 2 user1 user1 4096 Aug 11 2011 www

$ ls -l --full-time
total 32
drwxr-xr-x 2 user1 user1 4096 2010-09-10 17:50:09.000000000 +0900 Mail
drwxr-xr-x 5 user1 user1 4096 2010-10-12 20:04:04.000000000 +0900 Maildir
-rw-rw-r-- 1 user1 user1 9681 2015-02-08 13:03:35.000000000 +0900 ls.txt
drwxr-xr-x 5 user1 user1 4096 2014-03-14 10:59:45.000000000 +0900 work
drwxr-xr-x 2 user1 user1 4096 2011-08-11 10:54:02.000000000 +0900 www

BSDのlsでは --full-time が使えないので -T オプション

$ ls -l --full-time
ls: illegal option -- -
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
$ ls -lT
total 1557888
-rwxrwxrwx 1 user1 user1 48324512 3 21 09:02:28 2010 FILE0363.MOV
-rwxrwxrwx 1 user1 user1 44703024 3 21 09:03:40 2010 FILE0364.MOV
-rwxrwxrwx 1 user1 user1 45122244 3 21 09:06:24 2010 FILE0365.MOV
-rwxrwxrwx 1 user1 user1 2406116 3 21 09:06:32 2010 FILE0366.MOV
-rwxrwxrwx 1 user1 user1 2783000 3 21 09:07:58 2010 FILE0367.MOV
-rwxrwxrwx 1 user1 user1 51701320 3 21 09:09:14 2010 FILE0369.MOV
-rwxrwxrwx 1 user1 user1 93371356 3 21 09:13:56 2010 FILE0370.MOV
-rwxrwxrwx 1 user1 user1 71073692 3 21 09:18:20 2010 FILE0371.MOV
-rwxrwxrwx 1 user1 user1 277783952 3 21 09:24:24 2010 FILE0372.MOV
-rwxrwxrwx 1 user1 user1 131585552 2 8 08:33:00 2015 FILE0373.MOV
-rwxrwxrwx 1 user1 user1 28763404 3 21 09:40:58 2010 FILE0374.MOV



08 Feb, 2015 | mokimoc
« Prev item - Next Item »
---------------------------------------------

Comments



Leave comments

このアイテムは閲覧専用です。コメントの投稿、投票はできません。