sometime mkdir command in linux creating directory without time stamp
Hi,
i am using linux command "mkdir" for creating directories in c++. some times mkdir command creating directory without time stamp. is there any option to create directory with time stamp always. Thanks & Regards, suresh |
AFAIK a directory always has a timestamp. Do you mean the timestamp is zero? What are you using to display the timestamp? What does the output look like?
|
Hi catkin,
i have created TEMP directory using the following command mkdir TEMP output of ls -ltr TEMP drwxr-xr-x 4 root root 4096 Aug 2 2011 TEMP ls -ltr output will have only month date year no time(hours:minute:sec). Thanks & Regards, suresh |
ls -ltr TEMP should show you the contents of TEMP, not the directory itself.
Do you have ls aliased? what is the output of type ls ? You can check the detailed information of TEMP, including timestamps using stat TEMP |
For ls to list the directory itself, not the contents, use:
Code:
ls -d /path/to/directory |
There's setting somewhere in Unix such that recent dates are shown as
Mon daynum hh:mm & anything older than 'X' is shown as Mon daynum YYYY I think the usual default cutoff setting (ie 'X') is something like 6 or 9 mths. Has to be less than 12 mths so you can tell the diff between 2 Aug 2011 and 2 Aug 2010 etc. |
You have the timestamp, else you would not have the correct date. You're talking about the time ;)
The format can be influenced with the --times-style option chrism01's example is achieved with the following Code:
wim@webserver:~$ ls -l --time-style="+%T press <enter> here Question: Are you talking about different machines with different behavior? Or one machine that behaves as shown above. Or one machine that behaves inconsistently (e.g. after mkdir tmp1 you don't get the time and after mkdir tmp2 you do get the time)? PS The behavior you probably want is long-iso; the format you showed is "+%F" |
All times are GMT -5. The time now is 11:53 PM. |