LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-04-2005, 09:25 AM   #1
Grafbak
Member
 
Registered: Jun 2003
Location: /dev/null
Distribution: Knoppix 3.3
Posts: 61

Rep: Reputation: 15
output from ls command


Dear Gurus,

I am trying to make a text file from the contents of multiple directories with one command.
I have spent quite some time looking at SED, AWK, and LS ofcourse, but i can not get the output the way i desire.

What i need is this :

/home/user/download/imnuts.mp3
/home/user/download/movie.mpg
/home/user/other/other.txt
/home/user/mnt/totallydifferent/strange.txt

but all im getting right now is this :

/home/user/download :
imnuts.mp3
movie.mpg

/home/user/other :
other.txt

/home/user/mnt/totallydifferent:
strange.txt

It is frustrating me, i have browsed the entire forum (almost) and looked at tutorials on the internet, but i can't get it done.
The problem seems to be that i want multiple directories listed, and all the files listed below one another. If i do it with one directory like this : ls -lm1UAF /home/user/download/ i do get the desired format, however i want the names of the directories NOT to be listed, only file names with full path.

Basically i just want all the files in a tree, NO directorie-names, listed line by line, the full path. I want to use this file to import the files in a database.

If anyone can give me a hand i would appreciate it very much.
 
Old 08-04-2005, 09:32 AM   #2
Kdr Kane
Member
 
Registered: Jan 2005
Distribution: SUSE, LFS
Posts: 357

Rep: Reputation: 30
find /home/user
 
Old 08-04-2005, 09:36 AM   #3
Grafbak
Member
 
Registered: Jun 2003
Location: /dev/null
Distribution: Knoppix 3.3
Posts: 61

Original Poster
Rep: Reputation: 15
Thank you very much.

I have spent two days looking for those two words i guess God how i love linux

edit : The find command does almost what i want, however im still getting directory-names listed. I only want the files, listed with their full path.
I looked into the find command itself, but i can't seem to get rid of the directories. Anyone got a clue how to remove them ?

I don't know how to distinguish a directory from a file in bash.

Last edited by Grafbak; 08-04-2005 at 10:02 AM.
 
Old 08-04-2005, 10:18 AM   #4
rstewart
Member
 
Registered: Feb 2005
Location: Sunnyvale, CA
Distribution: Ubuntu
Posts: 205

Rep: Reputation: 38
find /home/user -type f -print
 
Old 08-04-2005, 10:22 AM   #5
Grafbak
Member
 
Registered: Jun 2003
Location: /dev/null
Distribution: Knoppix 3.3
Posts: 61

Original Poster
Rep: Reputation: 15
thank you so much. It was the -type f that i was looking for.
Another day is another lesson
 
Old 08-07-2005, 05:35 AM   #6
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
man is your friend - use it. man man to get started.
 
  


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
What is the command that use to get these output shinwai Linux - Newbie 2 08-31-2005 08:26 AM
Redirecting output to a command-line argument of another command madiyaan Linux - Newbie 1 02-19-2005 04:35 PM
' last -i ' command output praveenv Linux - Newbie 1 08-23-2004 02:14 PM
last -i command output praveenv Linux - Networking 2 08-18-2004 12:43 AM
last -i command output praveenv Linux - Networking 1 08-17-2004 06:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:19 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