Friday, March 11, 2011

linux change folder date

Need to change the folder date

I created a folder on 20110311

[root@localhost file_capture]# mkdir 20110101
[root@localhost file_capture]# ll
drwxr-xr-x 2 root root 4096 Mar 11 16:13 20110101


Change the date using touch

[root@localhost file_capture]# touch -t 201101010101
touch: missing file operand
Try `touch --help' for more information.
[root@localhost file_capture]# touch -t 201101010101 20110101/
[root@localhost file_capture]# ll
total 24
drwxr-xr-x 2 root root 4096 Jan 1 01:01 20110101

[root@localhost file_capture]# touch --help
Usage: touch [OPTION]... FILE...
Update the access and modification times of each FILE to the current time.

Mandatory arguments to long options are mandatory for short options too.
-a change only the access time
-c, --no-create do not create any files
-d, --date=STRING parse STRING and use it instead of current time
-f (ignored)
-m change only the modification time
-r, --reference=FILE use this file's times instead of current time
-t STAMP use [[CC]YY]MMDDhhmm[.ss] instead of current time
--time=WORD change the specified time:
WORD is access, atime, or use: equivalent to -a
WORD is modify or mtime: equivalent to -m
--help display this help and exit
--version output version information and exit

Note that the -d and -t options accept different time-date formats.

If a FILE is -, touch standard output.

Report bugs to .

No comments:

Post a Comment