By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,711 Members | 1,361 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,711 IT Pros & Developers. It's quick & easy.

Listing Directory Recursively

P: 30
Hi

I want list all files on all directory recursively.As example below,

/home/ashok>ls -1p
test.txt
test1.txt
directory1/
directory2/

/home/ashok> cd directory1/
ashok/directory1>ls -1p
a1.txt
a2.txt

ashok/directory1>cd ../directory2/
ashok/directory2>ls -1p
b1.txt
b2.txt


The above is the directory structure from home directory.
I want to display like this below from /home/ashok>
listing:::

test.txt
test1.txt
directory1/a1.txt
directory1/a2.txt
directory2/b1.txt
directory2/b2.txt

How do i do that.

Thanks in advance.Any suggestion is highly appriciated.

-Ashok
Aug 18 '08 #1
Share this Question
Share on Google+
4 Replies

ashitpro
Expert 100+
P: 542
try with 'find' command

find . -print

NOTE:There is dot after find command....
Aug 18 '08 #2

P: 30
It is exactely what i am expecting but the first entry is giving "."
I want all files under current and all child directories not any directory entry in the listing.But the first entry is a directory "."

Can you please suggest how do i remove the first entry.

-Ashok
Aug 18 '08 #3

ashitpro
Expert 100+
P: 542
It is exactely what i am expecting but the first entry is giving "."
I want all files under current and all child directories not any directory entry in the listing.But the first entry is a directory "."

Can you please suggest how do i remove the first entry.

-Ashok
Try this command..It will give you the list of files only...
all directory entries will be excluded..
find . -type f -print
Aug 18 '08 #4

P: 30
Really great....
Thanks a lot..
-Ashok
Aug 18 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.