Most UNIX Systems do not keep track of the creation date of a file (only the last access time, the last (data) modification time, and the last status modification time timestamps are specified by the standards). Sorting by ls (with the -t option and without the -S, -c, and -m options) sorts by increasing data modification time. But, as I'm sure you've noticed from the output in your examples, anything with a date in the future and anything with a date more than six months old will print the month, day, and year of the date while dates within the last six months will be printed with the month, day, and time of day (in 24 hour format).
So the command:
will give you the list of directories in the current directory matching the patterns you want sorted by increasing timestamp and the command:
will give you the same list sorted in reverse order.
But, neither of these will print the date in MM/DD/YYYY format.
Does HP/UX B.11.31 include a stat utility?
Do you just want directories located in the current directory, or do you also want to process subdirectories with matching names?
Do any of your directory names contain one or more space or tab characters? Do any of your directory names contain one or more newline characters? If the answer to both of these is no, there are several simplifying assumptions we can make.
Is MM/DD/YYYY format a requirement or a nice-to-have feature? If it is a requirement and your system doesn't have a stat utility, would you rather have a complicated shell script or a relatively simple C program?
What I know so far:
ls -A will list all files except those starting with a dot
ls -d will list all directories
ls -m will separate contents by commas
For getting crtimes use:
stat filename will give me the inode number
or
ls -i filename will give... (13 Replies)
i am having trouble creating a directory with last months date as the folder name.
what i am using is echo `date +%b%y`
which gives
Mar14 as the result but i want to get Feb14 as the result.:wall: (6 Replies)
Can anyone come up with a unix command that lists
all the files, directories and sub-directories in the current directory
except a folder called log.?
Thank you in advance. (7 Replies)
I have a top-level directory called work and I would like to create subdirectories work1 work2... under this directory. Also I would like to create subdirectory under work1 -- test, work2 -- test etc., Can I automate this using a command-line script?
work
|_work 1
|_test
|_work 2
... (2 Replies)
I am trying to link 2 directories using:
ln -s /net/<hostname>/srcdir/ /net/<desthostname>/dstdir/
I get the following error:
ln: /net/<desthostname>/dstdir: Function is not available
What is it that i am trying to do wrongly in the above operation?
Please use next time code tags (3 Replies)
Hi all,
Using grep command, i want to find the pattern of text in all directories and sub-directories.
e.g: if i want to search for a pattern named "parmeter", i used the command
grep -i "param" ../*
is this correct? (1 Reply)
It is for HP-Unix B.11.31.
Requirement:
1. List the directories, which directories name has given particular string.
Example: Directories with name "Build"
2. On the output of 1. list the directories by creation date as sort order.
I tried with; find . -type d -name "Build*"
... (3 Replies)
Hi,
Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process.
I wanted to disply using a unix command all the directories recursively excluding files.
I tried 'ls -FR' but that display files as... (3 Replies)
Hi ,
I am very new to unix as well as shell scripting. I have to write a script for the following requirement.
In a particular mount, have to list all the directories and sub directories along with size of the directory and sub directory in ascending order.
Please help me in this regard and many... (4 Replies)
I have a folder structure like the below
/test/test1/test2/app
/test/test3/app
/test/test4/test5/app
..
I need to create a new folder under "app" in all the above listed directory structure at one shot by the name "subapp" .
How can we acheive this using a script .
New to unix... (4 Replies)