List directories with given string, sort by creation date


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers List directories with given string, sort by creation date
# 1  
Old 10-27-2011
List directories with given string, sort by creation date

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*"

But I want the output to be sorted with creation date.
# 2  
Old 10-27-2011
Code:
$ find /your/home/path/ -name "Build*" -type d | xargs ls -ld


Last edited by jayan_jay; 10-27-2011 at 06:15 AM..
# 3  
Old 10-27-2011
Quote:
Originally Posted by jayan_jay
Code:
$ find /your/home/path/ -name "Build*" -type d | xargs ls -ld

Thanks, It works!
But how to get only the directory namd and it's creation data fields?
# 4  
Old 10-27-2011
Code:
$ find /your/home/path -name "Build*" -type d -exec ls -ld {} \; | awk '{print $6,$7,$8,$9}'

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort file data according to a custom list of string

I have a string of pre defined ip address list which will always remain constant their order will never change like in below sample: iplist=8.8.5.19,9.7.5.14,12.9.9.23,8.8.8.14,144.1.113 In the above example i m considering only 5 ips but there could be many more. Now i have a file which... (15 Replies)
Discussion started by: mohtashims
15 Replies

2. Shell Programming and Scripting

How to sort list of directories in descending order in perl?

Hi, I have a problem . I have few directories like inpTDT_1, inpTDT_2, inpTDT_3 and so on inside HOME directory . In one of my perl script (which is in my HOME), the above directories like inpTDT_1, inpTDT_2, inpTDT_3 are sorting out in an order So I wanted to sort all the inpTDT_1, inpTDT_2,... (1 Reply)
Discussion started by: venkatesh
1 Replies

3. Shell Programming and Scripting

Script to copy creation date over top of modified date?

Can someone draw up a script that for every file, folder and subfolder and files that will copy the creation date over top of the modified date?? I know how to touch every file recursively, but no idea how to read a files creation date then use that to touch the modification date of that file,... (3 Replies)
Discussion started by: toysareforboys
3 Replies

4. Shell Programming and Scripting

[Solved] Creation of directories

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)
Discussion started by: simkazw
6 Replies

5. UNIX for Dummies Questions & Answers

List the directories, having given pattern in the directories name, sorted by creation date

It is for HP-Unix B.11.31. Requirement: 1. List the directories, having given pattern in the directories name, sorted by creation date. Example: Directories with name "pkg32*" or "pkg33*" 2. On the output of 1. list the directories by creation date as sort order, with creation date... (2 Replies)
Discussion started by: Siva SQL
2 Replies

6. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

7. Shell Programming and Scripting

Automating creation of directories

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)
Discussion started by: sharone
2 Replies

8. HP-UX

Symbolic link creation between 2 directories on different machines

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)
Discussion started by: Amit Kulkarni
3 Replies

9. Shell Programming and Scripting

Creation of multiple directories

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)
Discussion started by: rajeshnatarajan
4 Replies

10. UNIX for Dummies Questions & Answers

Changing Creation Date to a Prespecified Date of a File In Unix

Dear Expert, Is there a command to do that in Unix? In such a way that we don't need to actually "write" or modified the content. -- monkfan (4 Replies)
Discussion started by: monkfan
4 Replies
Login or Register to Ask a Question