LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-28-2006, 11:39 AM   #1
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Rep: Reputation: 18
How to list files in subdirectrories with relative path?


I'd like to list files of a directory and its subdirectories with full paths. The output should look like this example:

Code:
me.jpg
pictures/01.jpeg
pictures/02.jpeg
pictures/03.jpeg
pictures/holdiday/01.jpg
pictures/holdiday/02.jpg
pictures/christmas/2001/02.jpg
pictures/christmas/2002/02.jpg
pictures/christmas/2003/02.jpg
I know about
Code:
$ ls */**
but that only shows files in the first subdirectory with relative path.

Is there another possibility?

Lotharster
 
Old 01-28-2006, 12:19 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
$ ls -R

You could have found this by looking at the man page

$ man ls

or by entering the "help" option with the ls command

$ ls --help
 
Old 01-28-2006, 12:20 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Code:
$ find | cut -c3-
If you don't mind the leading "./" on pathnames in the output, then just plain old "find" will do.
 
Old 01-28-2006, 12:21 PM   #4
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
Code:
ls -R
Should work, I cannot confirm for GNU ls as atm have access only to BSD ls.
 
Old 01-28-2006, 12:21 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by stress_junkie
$ ls -R

You could have found this by looking at the man page
This doesn't give the output format that was requested.
 
Old 01-28-2006, 01:06 PM   #6
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Original Poster
Rep: Reputation: 18
Smile Thanks!

Quote:
Originally Posted by haertig
Code:
$ find | cut -c3-
If you don't mind the leading "./" on pathnames in the output, then just plain old "find" will do.
Thanks, that's exactly what I was looking for!

Lotharster
 
  


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
relative to absolute path vishalbutte Programming 4 01-14-2006 03:17 PM
List files without path mijohnst Programming 2 12-05-2005 03:09 PM
TAR Archive file - need relative path cmd0a0 Linux - Software 2 10-19-2005 02:57 PM
how to find a relative path to another directory bahadur Programming 9 04-04-2005 07:52 PM
Relative Path? mikeshn Linux - General 3 05-10-2002 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:12 PM.

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