checking missing files in side a folder


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers checking missing files in side a folder
# 1  
Old 06-23-2006
Bug checking missing files in side a folder

Dear all,

Every hour i am receiving several data files to one folder for 24 hours each day.But some times some hours i do not have the files because of some problem.So i want to check the files inside the folder at the end of the day wether how many files i received in each hour like this.so i know if the files are missing , since missing hour files received is zero.

results should be like this,

00 hour - 15 files
01 housr - 14 files
02 hour - 10 files
-
-
23 hour - 5 files

can some help me to write a script for this ?


Nayanajith.
# 2  
Old 06-23-2006
what is the filenaming convention ?

or they created based on the hour they are created ?

if they are not modified, with the access time (which would be the same as creation time) also we can generate a requested list
# 3  
Old 06-23-2006
Quote:
Originally Posted by matrixmadhan
what is the filenaming convention ?

or they created based on the hour they are created ?

if they are not modified, with the access time (which would be the same as creation time) also we can generate a requested list


reply

They are created based on the hour.

eg,

Jun 22 23:12 0622.IST230500.00.pp_20060622_231252
Jun 22 23:22 0622.IST231000.00.pp_20060622_232223
Jun 22 23:22 0622.IST231500.00.pp_20060622_232252
Jun 22 23:42 0622.IST233500.00.pp_20060622_234252
Jun 22 23:52 0622.IST234000.00.pp_20060622_235222
Jun 23 00:02 0622.IST234500.00.pp_20060623_000252
Jun 23 00:03 0622.IST235000.00.pp_20060623_000322
Jun 23 00:12 0623.IST000000.00.pp_20060623_001252
Jun 23 00:22 0623.IST001000.00.pp_20060623_002222

so i have 5 files on 22nd and i have 4 files on 23rd.

Result should be,

Jun 22 23 hour - 5 files
Jun 23 00 hour - 4 files.

so i want a script get above result.

Thanks.
# 4  
Old 06-25-2006
Try this

>ll * |grep Jun |grep 22 |grep 23: |wc -l

above cmd will give you number of files created on Jun 22, 23hours. You can replace * with the file name pattern for specific files.
# 5  
Old 06-26-2006
Hi Naynajith

I am not sure is this one exctly you want. Any way hope that at least it will help you derive what you are looking for.

Here is the script I tried and as per my understanding of your question, it works!!!

#/bin/ksh
for i in "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23"
do
count=`ls -l | grep " $i " | nawk -v arg="$1" '{if(index($8,arg) == 1) print $0' | wc -l`
echo "Hour $i - $count File(s)"
done


The script accepts the date as runtime argument. For example I saved it as t.sh, then I did run the script as follows to get the report for Jun 26

$t.sh "Jun 26"


Hope it helps you!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Merging two text files side by side

Hi everyone, I need to merge two files side by side The files look something like this: HOSTNAME fishtornado-K52F 127.0.1.1 UPTIME 20:17:01 up 2:19, 3 users, load average: 0.00, 0.04, 0.05 DISK USAGE (Size/Used/Avail/Use%) 29G 6.5G 21G 25% RUN QUEUE PID COMMAND USER ... (4 Replies)
Discussion started by: FishTornado
4 Replies

2. UNIX for Dummies Questions & Answers

Paste many files together side by side

Hi, Thank you for your help in advance :D. I have thousands of files like... file01 file02 file03 . . . file6324 I would like to paste every other file side by side so it looks like file01 file02 file03 file04 ...e.t.c file6323 file6324 (3 Replies)
Discussion started by: shaz1990
3 Replies

3. UNIX for Dummies Questions & Answers

Script for checking the files in a folder

Hi , I am using the below script for checking for a file in a folder. if ; then echo 0 else echo 1 fi Is there any way we can check for files which are starting with GL*.csv.What I am trying to do is , I have to check in a folder for the GL*.csv files if there are any files they I... (6 Replies)
Discussion started by: wangkc
6 Replies

4. Shell Programming and Scripting

Combining two single column files side-by-side

Hi, I am looking for a sed/awk script to join two large (~300 M) single column files (one is sorted and the other is not sorted) side-by-side. I have a shell script but its taking ages to do the task so looking for an optimized fast solution. The two files look like: File1 (sorted) a1... (1 Reply)
Discussion started by: sajal.bhatia
1 Replies

5. Shell Programming and Scripting

Checking files in folder using starting string for filename

Hi, How do i check if there are any files present in the folder with some specific starting string. For eg :- I have used this where Source_File is filename parameter. if then return 2 fi But in my case the source file name is not constant. The only constant thing is... (10 Replies)
Discussion started by: chetancrsp18
10 Replies

6. Shell Programming and Scripting

AWK to merge multiple files side by side

I have about 100s of files of type text in a known directory. I want to merge all files side by side. Number of lines in all the files will remain same. For example file1 contains cat dog File 2 contains rat mat Output file should be cat rat dog mat Using awk I was able to... (5 Replies)
Discussion started by: kanthrajgowda
5 Replies

7. Shell Programming and Scripting

printing 3 files side by side based on similar values in rows

Hi I'm trying to compare 3 or more files based on similar values and outputting them into 3 columns. For example: file1 ABC DEF GHI file2 DEF DER file3 ABC DER The output should come out like this file1 file2 file3 ABC ABC (4 Replies)
Discussion started by: zerofire123
4 Replies

8. Shell Programming and Scripting

How to Merge / combine / join / paste 2 text files side-by-side

I have 2 text files, both have one simple, single column. The 2 files might be the same length, or might not, and if not, it's unknown which one would be longer. For this example, file1 is longer: ---file1 Joe Bob Mary Sally Fred Elmer David ---file2 Tomato House Car... (3 Replies)
Discussion started by: cajunfries
3 Replies

9. Shell Programming and Scripting

Script to place selected columns from a group of files side by side in a new file

Hi Everyone, I need a shell/perl script to bring selected columns from all the files located in a directory and place them in a new file side by side. File1: a b c d 2 3 4 5 f g h i .......... File2: I II III IV w x y z .............. and so on many files are there...... (8 Replies)
Discussion started by: ks_reddy
8 Replies

10. Shell Programming and Scripting

Continously checking folder and executing files

Hello All, I want to make a script which continously checks one folder all the time that is there is any file in it or not, and if it found any file in it than execute that file with the following command. apxrcv -text < filename > outputfile Actually my requirement is that i will put... (4 Replies)
Discussion started by: wakhan
4 Replies
Login or Register to Ask a Question