OpenWrt Forum Archive

Topic: touch command with option -d

The content of this topic has been archived on 22 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
Backfire 10.03.1 on TP-Link WR-1043ND
use the command touch with option -d to update the last-modified date on the given files

     touch -d '2010-10-10 10:10' test.file

I tried different date formats, but the result is always the same

root@OpenWrt:~# touch -d '2010-10-10 10:10' test.file
[b]touch: invalid option -- d[/b]
BusyBox v1.15.3 (2012-04-11 21:01:29 EEST) multi-call binary

Usage: touch [-c] [-d DATE] FILE [FILE]...

Update the last-modified date on the given FILE[s]

Options:
        -c      Do not create files
        -d DT   Date/time to use

where I'm wrong?
Thank you for your answers.

(Last edited by expm on 27 Apr 2012, 12:59)

You're not wrong, its likely that the busybox touch got compiled without support for the -d flag.

jow
thanks for the quick reply,
where I can set this option? how compiled with support the -d flag.
sorry, google did not help me sad

The "-d" option in "touch" is protected by "CONFIG_DESKTOP" in busybox.

make menuconfig -> Base System -> busybox -> Busybox Settings -> General Configuration -> [*] Enable options for full-blown desktop systems

thank you very much!

just rebuilt the image, the error is gone, but the date (time) modification of the file does not change

root@OpenWrt:~# touch -d '2010-10-10 10:10' test.file
root@OpenWrt:~# ls -l test.file
-rw-r--r--    1 root     root            0 Apr 29 15:01 test.file

what could be the reason?

p.s. maybe this is a bug earlier busybox, in OpenWrt from trunk (with busybox 1.19) I do not have these problems and the  touch works as expected.

(Last edited by expm on 30 Apr 2012, 08:31)

The discussion might have continued from here.