Sponsored Content
Top Forums UNIX for Dummies Questions & Answers list directories with more than X files Post 302570229 by vanessafan99 on Wednesday 2nd of November 2011 05:37:56 PM
Old 11-02-2011
do you mean it should be find "${mDir}" and not find ${mDir}?

does the {} mean you can attach other things to it?
thanks!

#!/usr/bin/ksh
find /home -type d | while read mDir; do
mTot=$(find "${mDir}" -type f | wc -l)
if test $mTot -gt 2000
then
echo "${mDir}:${mTot}"
fi
done


i think this works
it just takes a little while to get started (but psosibly due to a lot of files, i guess it cant be any faster than this)

thanks Smilie

---------- Post updated at 04:18 PM ---------- Previous update was at 04:16 PM ----------

sometimes it says that a directory cant be found, strange
find: /home/bbweb/public_html/media/categories/Signatures: No such file or directory


also when counting files,

can it only count what is directly under it? (either files or files + directories)

for example, it shows a lot of files under /home/vashleyb even though there are only 20 files + directories under it
/home/vashleyb should show a small number like 20 (either # of files or directories directly under it), and not the total # of files of everything under it

thanks

/home/vashleyb:16678
/home/vashleyb/public_html:16490
/home/vashleyb/public_html/gallery:12825
/home/vashleyb/public_html/gallery/albums:10569
/home/vashleyb/public_html/gallery/albums/userpics:5452
/home/vashleyb/public_html/gallery/albums/userpics:5452

---------- Post updated at 04:37 PM ---------- Previous update was at 04:18 PM ----------

i put in -maxdepth 1

mTot=$(find "${mDir}" -type f -maxdepth 1 | wc -l)

which is ok now

its trying to find some directories that dont exist though, not sure why
find: /home/ultbrit/public_html/photos/albums/Ontour/Babyonemoretime/July 06 1999 - Washington DC: No such file or directory
find: /home/ultbrit/public_html/photos/albums/Ontour/House of Blues: No such file or directory
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List specific files from directories

Hello, I would like to list the files from all directories that has been modified more than 1 month ago, and whose name is like '*risk*log'. I think a script like this should work : ls -R | find -name '*risk*.log' -mtime 30 -type f But it tells me "no file found" though I can see some. ... (4 Replies)
Discussion started by: Filippo
4 Replies

2. UNIX for Dummies Questions & Answers

List directories and files

I want to count how many levels there are under a directory. I repeat level. Also how i count only all the files in a directoy ( all files of all directories of all leves down!) and how can i count only all the directories under a directory (including subdirectories, all levels down) ... (2 Replies)
Discussion started by: psalas
2 Replies

3. Shell Programming and Scripting

Command to list only files omit directories.

Hi All I am writting a script that does a comparison between files in 2 diffectent directories. To do this I need a command that will list out only the files in a give directory and omit any sub dorectories with that directory. But I am unable to find it. Please Help. I tried ls... (5 Replies)
Discussion started by: Veenak15
5 Replies

4. Shell Programming and Scripting

How to get a list of files in a dir w/o sub-directories?

Hi I am looking for the correct syntax to find all files in the current directory without listing sub-directoris. I was using the following command, but it still returns subdirectoris and files inside them: $ ls -laR | grep -v ^./ Any idea? Thanks PS I am in ksh88 (4 Replies)
Discussion started by: aoussenko
4 Replies

5. UNIX for Dummies Questions & Answers

List directories and sub directories recursively excluding files

Hi, Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process. I wanted to disply using a unix command all the directories recursively excluding files. I tried 'ls -FR' but that display files as... (3 Replies)
Discussion started by: pointers
3 Replies

6. UNIX for Dummies Questions & Answers

List directories, subs and files

Hi, I try to list all files in a folder, including all the subdirs (and their subdirs) and all files contained in each of these folders. I then print it to a simple txt file. I use ls -R -1 >test.txt This sort of does what I need, yet, the result is something like: It reasonably comes... (53 Replies)
Discussion started by: dakke
53 Replies

7. UNIX for Dummies Questions & Answers

List biggest files (Not Directories)

Hello, can you please help me writing a command that would output the biggest files on my system from biggest to smallest? I want this to print only the files, not the directories. I have tried du -a ~ | sort -nr | head -10 However, this also prints out all the directories - which I do... (8 Replies)
Discussion started by: tonydaniels1980
8 Replies

8. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

9. UNIX for Dummies Questions & Answers

Find Files In A List with known Partial Directories

First I'm new to Linux and have used the find command pretty often but this is where I've hit a snag. I have a file that contains 3500 files that I want to find and then eventually copy to my own directory (these files are all on a shared directory at work atm). Our work computer are huge and... (2 Replies)
Discussion started by: Myrona
2 Replies

10. Solaris

A way to list directories that contain specific files.

Hi everyone My issue is this, I need to list all the sub directories in a directory that contains files that have the extension *.log, *.dat and *.out . After reviewing the output i need to delete those directories i do not need. I am running Solaris 10 in a bash shell. I have a script that I... (2 Replies)
Discussion started by: jsabo40
2 Replies
XSetFontPath(3X11)						     MIT X11R4							XSetFontPath(3X11)

Name
       XSetFontPath, XGetFontPath, XFreeFontPath - set, get, or free the font search path

Syntax
       XSetFontPath(display, directories, ndirs)
	  Display *display;
	  char **directories;
	  int ndirs;

       char **XGetFontPath(display, npaths_return)
	  Display *display;
	  int *npaths_return;

       XFreeFontPath(list)
	  char **list;

Arguments
       directories
		 Specifies the directory path used to look for a font.	Setting the path to the empty list restores the default path defined for
		 the X server.

       display	 Specifies the connection to the X server.

       list	 Specifies the array of strings you want to free.

       ndirs	 Specifies the number of directories in the path.

       npaths_return
		 Returns the number of strings in the font path array.

Description
       The function defines the directory search path for font lookup.	There is only one search path per X server, not one per client.  The
       interpretation of the strings is operating system dependent, but they are intended to specify directories to be searched in the order
       listed.	Also, the contents of these strings are operating system dependent and are not intended to be used by client applications.  Usu-
       ally, the X server is free to cache font information internally rather than having to read fonts from files.  In addition, the X server is
       guaranteed to flush all cached information about fonts for which there currently are no explicit resource IDs allocated.  The meaning of an
       error from this request is operating system dependent.

       can generate a error.

       The function allocates and returns an array of strings containing the search path.  When it is no longer needed, the data in the font path
       should be freed by using

       The function frees the data allocated by

Diagnostics
       Some numeric value falls outside the range of values accepted by the request.
		 Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument
		 defined as a set of alternatives can generate this error.

See Also
       XListFont(3X11), XLoadFonts(3X11)
       X Window System: The Complete Reference, Second Edition, Robert W. Scheifler and James Gettys

																XSetFontPath(3X11)
All times are GMT -4. The time now is 05:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy