LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-11-2005, 04:32 AM   #1
MikeHunt79
LQ Newbie
 
Registered: Mar 2005
Posts: 2

Rep: Reputation: 0
LS and shellscript - I'm stuck


Ok, I'm in the middle of writing some shellscript... and I've become a bit stuck.

I need to get a directory listing into a file, but here's the catch... I need the path preceding it. Now in DOS (booo) I found that if I do "dir /S /b", i get a nice directory listing with each file having the path preceding it, but I can't figure out how to do this in Linux.

Heres a sample of what I need:

/home/httpd/index.htm
/home/httpd/blob.gif
/home/httpd/myscript.sh

instead of

/home/httpd/:
index.htm
blob.gif
myscript.sh

Now, I've read and re-read the manual for "ls" many times, get I can't find a way to do the same thing under linux... The closest I've come is "ls -AR1"

Would a bit of shellscript be able to achieve this?
 
Old 03-11-2005, 04:38 AM   #2
gerardt
Member
 
Registered: Feb 2005
Location: South Africa
Distribution: SuSE
Posts: 60

Rep: Reputation: 15
try using find on the directory of your choice with no other criterion or actions.
finds output is in the form you desire.
 
Old 03-11-2005, 04:44 AM   #3
MikeHunt79
LQ Newbie
 
Registered: Mar 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Ooo... the find command. I've never used that one before.

I've had a quick play with it, and it works a treat. Thanks.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Shellscript paraiso Linux - Newbie 7 05-12-2005 07:25 AM
Lockscreen Shellscript 2 paraiso Linux - General 1 05-11-2005 05:30 PM
Table format with ShellScript paraiso Linux - General 2 05-11-2005 06:39 AM
shellScript help paraiso Linux - Newbie 2 05-10-2005 07:09 PM
ShellScript sharadgana Programming 1 12-16-2004 01:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration