Script /commands to get all the files count


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Script /commands to get all the files count
# 1  
Old 02-19-2019
Script /commands to get all the files count

Hello All,

I would need to write a shell script to find the files generation count for the given day and the folder.Presently I am using
Code:
(ls -ltr *filename* | grep "Feb  19" | wc -l )

from each folder and getting the counts.I would like to create a script which will get the counts under the directory from given folders.Please help me with this requirement.I know very basic about Shell scripting. Thank you

Last edited by vbe; 02-20-2019 at 04:21 AM.. Reason: code tags, typos
# 2  
Old 02-20-2019
Hi,
Maybe so
Code:
grep -lr "Feb  19" --include="*filename*" ./ | xargs dirname | sort | uniq -c

--- Post updated at 12:41 ---

I advise you to use "grep" with options -Is additionally in the production
and xargs dirname 2>/dev/null

Last edited by nezabudka; 02-20-2019 at 05:49 AM..
# 3  
Old 02-20-2019
Please always post your OS, shell, and deployed tools' versions, so people know what limitations or extra features they suffer / offer. And, it helps to precisely define WHAT you're after. What does "from given folder" mean?


Did you consider the find command with the -mtime or -newer tests?
# 4  
Old 02-20-2019
Thank you for your response. I would like to get the counts from each sub directory under ZUR (My directory path:Tableau/Tabsan/Ouputs/ZUR) ZUR has many sub directories in it. I would like to get the outputs generated under ZUR and send them in an email.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for field wise record count for different Files .csv files

Hi, Very good wishes to all! Please help to provide the shell script for generating the record counts in filed wise from the .csv file My question: Source file: Field1 Field2 Field3 abc 12f sLm 1234 hjd 12d Hyd 34 Chn My target file should generate the .csv file with the... (14 Replies)
Discussion started by: Kirands
14 Replies

2. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

3. Shell Programming and Scripting

Script to compare count of two csv files

Hi Guys, I need to write a script to compare the count of two csv files each having 5 columns. Everyday a csv file is recived. Now we need to compare the count of todays csv file with yesterday's csv file and if the total count of records is same in todays csv file and yesterday csv file out... (3 Replies)
Discussion started by: Vivekit82
3 Replies

4. Shell Programming and Scripting

Script To read Date and count from files

Smaple 1 Date and Time: 2013-05-11 12:23:12 MST abc,1234,hi-all,45354-88888,IN,US XYZ,1234,hi-all,45354-88888,OUT,GB abc,1234,hi-all,45354-88888,IN,AS abc,1234,hi-all,45354-88888,OUT,US abc,1234,hi-all,45354-88888,IN,US Number of Records: 000005 Sample 2 HDR: 20130511... (1 Reply)
Discussion started by: Abhisrajput
1 Replies

5. Shell Programming and Scripting

Script for count files and send mails

Hi. I'm new on this forum and I need if possible someone to help me with one script. The script should act like this: - should be run by crontab and have next parameters: script_name $par1 $par2 $par3 $par4 where script will search in dir $par1 for files with mask $par2 and if number of... (2 Replies)
Discussion started by: atrailm
2 Replies

6. Shell Programming and Scripting

Script to count number of files in directories

Hi All! I would like to have a script that will count the number of files at the top of the hour of soome directories and mail the results to me. I was thinking on : a=`/directory/subdirectory/ | wc -l` echo "/directory/subdirectory :$a" b=`/another_dir/subdir/ | wc -l` echo... (12 Replies)
Discussion started by: fretagi
12 Replies

7. Shell Programming and Scripting

Simple script to count files

Hello, I am new to shell scripting and I need your help. I have found similar scripts in the forum but I need further assistance. I am building a script to use hourly in cron to mailx me if the number of files in a path is less than e.g 100 I have started with the following: #!/bin/sh... (2 Replies)
Discussion started by: drbiloukos
2 Replies

8. UNIX for Dummies Questions & Answers

Script to get Row Count of ZIP Files

Hi, I have some data files in a zipped format.(eg: aa.gz).I would like to know the number or rows in each zip file(May be populate the file name and line numbers into a text file).I know the commands wc -l and gunzip,.But how I will create a shell script for this to extract each files and get... (5 Replies)
Discussion started by: abhilash_menon
5 Replies

9. 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

10. Shell Programming and Scripting

script to count files in a directory

Hello, I was wondering if anyone had an answer for this? thanks, KW (3 Replies)
Discussion started by: kwa71
3 Replies
Login or Register to Ask a Question