LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-04-2005, 05:24 AM   #1
facets
LQ Newbie
 
Registered: May 2004
Distribution: Fedora Core 2 / Damnsmalllinux
Posts: 18

Rep: Reputation: 0
Find question


Hi,

I need to find the last directory in a bunch of directories but can't work out how to do it. There is no exact structure so here's a rough example.

/home/dir1/movies
/home/dir2/music/jazz
/home/dir2/music/house
/home/dir3/apps/linux/cad
/home/dir3/apps/linux/graphcs

So with the example, i would like /home/dir2/music/jazz int he list but not /home/dir2/music same goes for /home/dir3/apps/linux/cad not /home/dir3/apps/linux.

I've tried -maxdepth and -mindepth but to no avail.

Any help would be rad.

cheers, William
 
Old 03-04-2005, 06:54 AM   #2
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
Sounds like you need some sort or recursive script to dig into the directories. What would be the last directory for

/home/dir3/apps/linux/cad
/home/dir3/apps/linux/graphcs

cad, graphcs or both?
 
Old 03-04-2005, 06:57 AM   #3
facets
LQ Newbie
 
Registered: May 2004
Distribution: Fedora Core 2 / Damnsmalllinux
Posts: 18

Original Poster
Rep: Reputation: 0
thanks for the reply.

the -prune flag helped here..

find -mindepth 4 -prune -type d

cheers! mark.

snip...

./Stuff/Music/[313 Crewz]/dj3000 - red line ep
./Stuff/Music/[313 Crewz]/Midnight Sound
./Stuff/Music/[313 Crewz]/[LH 004] Los Hermanos - Influence
./Stuff/Music/[313 Crewz]/inner elements[rs 94 038 cd]
./Stuff/Music/German Crewz/rs-06
./Stuff/Music/German Crewz/burnt friedman & jaki liebezeit - secret rhythms
./Stuff/Music/German Crewz/[GIGOLO 99] Dopplereffekt - Linear accelerator
 
Old 03-04-2005, 07:04 AM   #4
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
When you do that on

/home/dir3/apps/linux/cad
/home/dir3/apps/linux/graphcs

doesn't that bring up

/home/dir3/apps/linux
/home/dir3/apps/linux/cad
/home/dir3/apps/linux/graphcs

also would that work for

/home/dir1
/home/dir2
/home/dir3

Just a thought. If you've solved it great
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Question about FIND katsal Linux - General 4 04-28-2005 04:11 AM
find question coder22 Linux - Newbie 3 02-21-2005 07:11 AM
'find' expression question Thorsten Linux - General 3 05-03-2004 07:41 AM
Question on find command rytrom Linux - Newbie 3 08-07-2003 02:14 AM
question on find pfunk Linux - General 4 07-10-2002 05:27 AM


All times are GMT -5. The time now is 12:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration