Sponsored Content
Top Forums Shell Programming and Scripting Script to count number of files in directories Post 302730681 by jim mcnamara on Tuesday 13th of November 2012 12:00:33 PM
Old 11-13-2012
Code:
#!/bin/ksh
for dir in /directory1/subdirectory /directory2/subdirectory
/directory3/subdirectory 
do
#echo "$dir $( find $dir -type f |wc -l)"
  echo "$dir find $dir -type f |wc -l"
done > ./message1
mailx -s "nš files" fretagi@mcel.co.mz < ./message1

Try the change in red.
 

10 More Discussions You Might Find Interesting

1. Solaris

Get Count of all files in all the directories

Hello, I am looking for a way to get the TOTAL COUNT of the files present in all directories(sub directories) under the root directory..The files can be of any type viz. txt, doc, html, wav, jpeg etc. If it has an extension, it has to be counted.. I want to run the script from the root directory.... (6 Replies)
Discussion started by: oniondosa
6 Replies

2. Shell Programming and Scripting

AWK Script - Count Files In Directories

Hey, I'm very new to AWK and am trying to write a script that counts the number of files in all subdirectories. So, basically, my root has many subdirectories, and each subdirectory has many files. How can I get the total count? I haven't been able to figure out how to loop through the... (1 Reply)
Discussion started by: beefeater267
1 Replies

3. Shell Programming and Scripting

Count of files in directories

Hi, I have a requirement to find out the count of files in directories. I can do this very well by goind to each directory and then ls -lrt | wc -l. But I need to do it for hundreds of directories/sub-directories. I tried with this - for i in `ls -F | grep '/$'`; do `echo "$i"`| ls -lrt... (2 Replies)
Discussion started by: unx100
2 Replies

4. Shell Programming and Scripting

perl script on how to count the total number of lines of all the files under a directory

how to count the total number of lines of all the files under a directory using perl script.. I mean if I have 10 files under a directory then I want to count the total number of lines of all the 10 files contain. Please help me in writing a perl script on this. (5 Replies)
Discussion started by: adityam
5 Replies

5. Shell Programming and Scripting

Need script to count specific word and iterate over number of files.

Hi Experts, I want to know the count of specific word in a file. I have almost 600+ files. So I want to loop thru each file and get the count of the specific word. Please help me on achieving this... Many thanks (2 Replies)
Discussion started by: elamurugu
2 Replies

6. UNIX for Dummies Questions & Answers

How to get number of files and directories?

Hi All, can you please tell me how to get no.of files and directories in the given directory.:confused: (4 Replies)
Discussion started by: raju110384
4 Replies

7. UNIX for Dummies Questions & Answers

Count of files and directories

Hi I have a jfs2 filesystem named /software in my aix 5.3 box. Please note that there are a lot of subdirectories under /software? I need to know the count of how many total files and directories are present under that mount point /software ? For example if by some commands we find that there... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

8. Shell Programming and Scripting

How to count number of files in directory and write to new file with number of files and their name?

Hi! I just want to count number of files in a directory, and write to new text file, with number of files and their name output should look like this,, assume that below one is a new file created by script Number of files in directory = 25 1. a.txt 2. abc.txt 3. asd.dat... (20 Replies)
Discussion started by: Akshay Hegde
20 Replies

9. Shell Programming and Scripting

List directories and count files inside

I'm trying to make a script that will list all directories under a selection as well as the number of files in each. I cannot get it to work under a symbolic link. The file structure is: XXX_20131127_001 dir01 (sym link) 2404x912 file.0000.xxx to ... (10 Replies)
Discussion started by: scribling
10 Replies

10. Shell Programming and Scripting

Count files between multiple directories

Hi All, Everyday we will receive 33 files in our source directory(/prd/pk) with the current date. Once our jobs are completed all the 33 files immediately will be moved to backup folder (/prd/pk/backup). Now, I need to check between source file directory (/prd/pdk) and backup file directory... (3 Replies)
Discussion started by: suresh_target
3 Replies
conflict(8)						      System Manager's Manual						       conflict(8)

NAME
conflict - search for alias/password conflicts SYNOPSIS
/usr/lib/mh/conflict [-help] [-mail name] [-search directory] [aliasfiles...] OPTIONS
Prints a list of the valid options to this command. Mails the results to the specified name. Otherwise, the results are sent to the stan- dard output. Searches directories other than /usr/spool/mail, and reports anomalies in those directories. The -search switch can appear more than once in an invocation to conflict, with different directories named. DESCRIPTION
The conflict program checks to see if the interface between MH and transport system is in good shape. It also checks for maildrops in /usr/spool/mail which do not belong to a valid user. It assumes that no user name will start with a dot (.) and thus ignores files in /usr/spool/mail which begin with a dot. The conflict program checks the entries in the specified alias files. It parses the entries in the same way that post would, and outputs any errors which it finds. The program can be used to check the entries in a user's personal alias file, or in the system alias file, /usr/lib/mh/MailAliases. If no alias file is specified, conflict checks the system alias file. The conflict program also checks the /etc/group file for entries which do not belong to a valid user, and for users who do not have a valid group number. In addition, duplicate users and groups are noted. The conflict program should be run under cron, or whenever system accounting takes place. FILES
The system customization file. The system password file. The system group file. Program used to mail results, if the -mail option is used. Directory containing users' maildrops. SEE ALSO
Commands: cron(8) Files: mh-alias(4) conflict(8)
All times are GMT -4. The time now is 10:17 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy