LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Determine if folder has subfolders with out overhead from find or ls (https://www.linuxquestions.org/questions/programming-9/determine-if-folder-has-subfolders-with-out-overhead-from-find-or-ls-512341/)

davstin2002 12-20-2006 05:07 PM

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
----------------------------
+etc
+home
-usr
-local
+bin
+sbin
-var
+lib
+mysql
+www
-----------------------------

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:

----------------------------
+etc
+home
-usr
-local
bin
sbin
-var
+lib
+mysql
+www
-----------------------------


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.

Thanks

David

reddazz 12-20-2006 06:49 PM

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.


All times are GMT -5. The time now is 02:43 PM.