The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
display number of subdirectories jjamd64 Shell Programming and Scripting 2 12-13-2007 12:06 PM
Backup Directories and SubDirectories with log using DOS osramos Windows & DOS: Issues & Discussions 1 11-14-2007 06:10 PM
Compare/Diff between directories and subdirectories? andylee80 UNIX for Dummies Questions & Answers 5 07-12-2007 10:45 AM
Permissions for Directories and Subdirectories clancymf UNIX for Dummies Questions & Answers 1 08-07-2006 07:40 PM
How to Remove Ctrl M characters in files from directories and its subdirectories skdp Shell Programming and Scripting 7 07-30-2006 12:53 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-24-2007
HAA HAA is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 24
Display only subdirectories from given directories

Hi Genius,

I would like to display all the subdirectories only with timestamp.

For exmple:

Given Directory : orabkup

/orabkup
total 11365112
drwxr-xr-x 9 oracle oradba 256 Jan 03 16:01 db1

/orabkup/db1:
total 0
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 ddl
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupd_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupc_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupb_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupa_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backup_ro
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backup

I would say thanks in advance whoever help me on above.

Regards,
HAA
  #2 (permalink)  
Old 04-25-2007
HAA HAA is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 24
Display subfolders from given folder

Hi Genius,

I would like to display all the subdirectories only with timestamp.

For exmple:

Given Directory : orabkup

/orabkup
total 11365112
drwxr-xr-x 9 oracle oradba 256 Jan 03 16:01 db1

/orabkup/db1:
total 0
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 ddl
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupd_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupc_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupb_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backupa_rw
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backup_ro
drwxr-xr-x 2 oracle oradba 256 Jan 03 16:01 backup

I would say thanks in advance whoever help me on above.

Regards,
HAA
  #3 (permalink)  
Old 04-25-2007
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
First suggestion: I'm not sure if we have any users named Genius. And if we do, unless you are addressing the post to them, don't start with 'Hi Genius'.

Now for your question, you can use the find command to do this. It will, by default, recurse into any subdirectories that are present in your given directory. The find command goes like this:
Code:
find <dir to search in> -type d # this restricts the search to directories only

# example:
find /orabackup -type d -exec ls -ld {} \;
For more details on find, as always, lookup the man page.
  #4 (permalink)  
Old 04-25-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,540
don't understand. What have you tried? doesn't the normal "ls -ltr" command work for you?, or maybe i misinterpret what you want.
  #5 (permalink)  
Old 04-25-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Code:
ls -lR | awk ' NF < 3 || /^d/ && sub($1" +"$2" +"$3" +"$4" +"$5,"") '
  #6 (permalink)  
Old 04-25-2007
HAA HAA is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 24
Once again Excellent reply Anbu.

Many thanks to u,

in same manner i want to display the size of the directory,permissions along with timestamp.

Regards,
HAA
  #7 (permalink)  
Old 04-25-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Quote:
Originally Posted by HAA
Once again Excellent reply Anbu.

Many thanks to u,

in same manner i want to display the size of the directory,permissions along with timestamp.

Regards,
HAA
Change sub function in above code to get what you need
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:39 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0