Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


Closed Thread
  Search this Thread
Old 12-20-2006, 04:07 PM   #1
LQ Newbie
Registered: Jan 2004
Location: TX
Distribution: Fedora Core
Posts: 29

Rep: Reputation: 15
Question Determine if folder has subfolders with out overhead from find or ls

I am writing a program with a folder tree using php.

I want to determine if a folder has subfolders or not for the folder tree so i can use plus/minus for expand.

For example, assume i'm looking at the following folder structure

where /usr/local and /var are expanded & everything else is collapsed. I want to avoid having a +/- sign if a folder has no subfolders. For example, my /usr/local/bin and /usr/local/sbin don't have subfolders so I would rather it look like this:


The graphics side of things i can handle. The part i'm having a problem with is the determining of subfolders. The command I'm using right now to determine is this:
`find /some/path -type d -maxdepth 1`
However I've got some folders with a bunch of stuff in them. So I get a lot of overhead as it searches through unnecessary stuff.

I've tried something similar with ls but get a lot of overhead as well.

I've searched google but didnt find anything useful.

Any help would be appreciated.


Old 12-20-2006, 05:49 PM   #2
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

Closed Thread

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
how to determine the folder contain data or not izza_azhar Programming 2 05-24-2005 07:38 PM
determine whether 'find' cmd found the file or not mufy Linux - General 7 03-16-2005 07:24 AM
need a script to delete all files from a folder and subfolders cccc Programming 1 03-04-2005 10:54 AM
How to make JHEAD work on all subfolders within a folder SupaDucta Linux - Newbie 0 11-26-2004 06:02 PM
changeing permissions for a folder + subfolders and files ? YBA^[x] Slackware 7 08-06-2004 04:07 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:42 PM.

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