Sponsored Content
Top Forums UNIX for Dummies Questions & Answers ls command to list recursively ONLY subdirectories Post 90319 by HLee1981 on Monday 21st of November 2005 04:56:44 PM
Old 11-21-2005
Question ls command to list recursively ONLY subdirectories

Smilie
ls -dlRr
I've tried different combinations of the ls command using the above-mentioned options but none of them are giving me the output I am looking for.

Objective: To get a recursive listing of all subdirectories from a particular starting point. For example, if my starting point is directory A, and directory A contains subdirectories B, C, D, and each of the subdirectories contains a combination of directories and files called B1, C1, D1, etc., I want a recursive listing of the subdirectories contained, so the output will be something like
A
./B
./B1
./C1
etc. while excluding the list of the individual files.

I tried doing a search for 'ls' in the forum but didn't see anything within the first two pages of the results that the search pulled.

Help please!

Thanks!

- Hae

--- Edit ---

Nevermind! Found the answer at https://www.unix.com/showthread.php?t...t=ls+recursive

Last edited by HLee1981; 11-21-2005 at 06:08 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

List Files Recursively

Hi! I'd like to list my files recursively BUT: I want them in this format, so that I can use them as options for commands like ftp->put or del ./directory1/file1.tar ./directory1/file2.tar ./directory1/file3.tar ./directory2/file1.tar ./directory2/file2.tar ./directory2/file3.tar... (9 Replies)
Discussion started by: roberthawke
9 Replies

2. Shell Programming and Scripting

Recursively go thorough subdirectories and checkout files

Hi, I would need to go through all the subdirectories, find each file and would need to check them out(using clearcase, which I know). But could you please help me how to find all the files under all subdirectories.. there could be multiple directories and subdirs... Sas (3 Replies)
Discussion started by: shajiasalim
3 Replies

3. UNIX for Dummies Questions & Answers

recursively concatenate files in subdirectories with same folder name

I'm trying to concatenate files in subdirectories with the same folder name. Say concatenate all the files in the 'current' subdirectories in 'Literature' parent directory. Literature/USA/current/ Literature/Europe/current/ Can anyone help with it? Thanks a lot! (2 Replies)
Discussion started by: joyce007
2 Replies

4. UNIX for Advanced & Expert Users

Recursively concatenate files in subdirectories with the same folder name

I'm trying to concatenate files in subdirectories with the same folder name. Say concatenate all the files in the 'current' subdirectories in 'Literature' parent directory. Literature/USA/current/ Literature/Europe/current/ Can anyone help with it? Thanks a lot! (2 Replies)
Discussion started by: joyce007
2 Replies

5. Shell Programming and Scripting

Filter only gz files from list of subdirectories

Hi, I have a very big directory structure that consists of many sub-directories inside.There are around 50 ".gz" files under this dir structure. I want to copy all the gz files alone to a seperate location. Plz help me. (2 Replies)
Discussion started by: villain41
2 Replies

6. Shell Programming and Scripting

Remove files from subdirectories given a list of filenames

Dear all, I have a dir structure like main_dir At_nn Ag_js Nf_hc .... mcd32 mgd43... mcd32 mgd43... mcd32 mgd43... and each subdir (e.g. mcd32, mgd43) contains files. Now, i... (15 Replies)
Discussion started by: yogeshkumkar
15 Replies

7. Shell Programming and Scripting

How to recursively search for a list of keywords in a given directory?

Hi all, how to recursively search for a list of keywords in a given directory?? for example: suppose i have kept all the keywords in a file called "procnamelist" (in separate line) and i have to search recursively in a directory called "target/dir" if i am not doing recursive search then... (4 Replies)
Discussion started by: neelmani
4 Replies

8. UNIX for Advanced & Expert Users

List all files in subdirectories which are modifiled recently.

Hello, I wanted to list all files in subdirectories which are modifiled recently. need to display all files with full details like hpw it display with ls -l ( date, size,..) Thanks Bala (3 Replies)
Discussion started by: balareddy
3 Replies

9. UNIX for Dummies Questions & Answers

How to list the names of the files from all the subdirectories?

Hi, I'm currently trying to print the names of all the .txt files in the subdirectories that contain the string I'm searching. I tried with this code, but it seems that it searches for the names that matches the string instead of searching for the string in the individual files and printing the... (2 Replies)
Discussion started by: nuclearpenguin
2 Replies

10. UNIX for Beginners Questions & Answers

UNIX command to display Owner,Group,Root and Subdirectories list

Hi Team, Am a newbie to Unix. As I would like to see the Server Name,Owner Name ( not numeric form), Group Name ( not numeric ID), ROOT path. I would like to send this list as an attachment to my personal mail. Can any one please help me out to to resolve this . Here is the sample result... (6 Replies)
Discussion started by: vasuvv
6 Replies
AFS-UP(1)						       AFS Command Reference							 AFS-UP(1)

NAME
up - Recursively copy directories, preserving AFS metadata SYNOPSIS
up [-v] [-1] [-f] [-r] [-x] [-m] <source directory> <destination directory> DESCRIPTION
The up command recursively copies the files and subdirectories in a specified source directory to a specified destination directory. The command interpreter changes the destination directory and the files and subdirectories in it in the following ways: o It copies the source directory's access control list (ACL) to the destination directory and its subdirectories, overwriting any existing ACLs. o If the issuer is logged on as the local superuser root and has AFS tokens as a member of the group system:administrators, then the source directory's owner (as reported by the "ls -ld" command) becomes the owner of the destination directory and all files and subdirectories in it. Otherwise, the issuer's user name is recorded as the owner. o If a file or directory exists in both the source and destination directories, the source version overwrites the destination version. The overwrite operation fails if the first (user) "w" (write) mode bit is turned off on the version in the destination directory, unless the -f flag is provided. o The modification timestamp on a file (as displayed by the "ls -l" command) in the source directory overwrites the timestamp on a file of the same name in the destination directory, but the timestamp on an existing subdirectory in the destination directory remains unchanged. If the command creates a new subdirectory in the destination directory, the new subdirectory's timestamp is set to the time of the copy operation, rather than to the timestamp that the subdirectory has in the source directory. The up command is idempotent, meaning that if its execution is interrupted by a network, server machine, or process outage, then a subsequent reissue of the same command continues from the interruption point, rather than starting over at the beginning. This saves time and reduces network traffic in comparison to the UNIX commands that provide similar functionality. The up command returns a status code of 0 (zero) only if it succeeds. Otherwise, it returns a status code of 1 (one). This command does not use the syntax conventions of the AFS command suites. Provide the command name and all option names in full. OPTIONS
-v Prints a detailed trace to the standard output stream as the command runs. -1 Copies only the files in the top level source directory to the destination directory, rather than copying recursively through subdirectories. The source directory's ACL still overwrites the destination directory's. (This is the number one, not the letter "l".) -f Overwrites existing directories, subdirectories, and files even if the first (user) "w" (write) mode bit is turned off on the version in the destination directory. -m Recognize and copy mount points rather than traversing the volumes they reference during the recursive copy operation. Without -m, up's default behavior is to copy the contents of all volumes and subvolumes mounted under the source directory into the volume containing the destination directory. -r Creates a backup copy of all files overwritten in the destination directory and its subdirectories, by adding a ".old" extension to each filename. -x Sets the modification timestamp on each file to the time of the copying operation. source directory Names the directory to copy recursively. destination directory Names the directory to which to copy. It does not have to exist already. EXAMPLES
The following command copies the contents of the directory dir1 to directory dir2: % up dir1 dir2 PRIVILEGE REQUIRED
The issuer must have the "a" (administer) permission on the ACL of both the source and destination directories. COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 AFS-UP(1)
All times are GMT -4. The time now is 06:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy