The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Auto copy for files from folder to folder upon instant writing Bashar UNIX for Advanced & Expert Users 2 08-21-2008 11:44 AM
How to print two sql query outputs side by side in excel prasee Shell Programming and Scripting 6 09-07-2007 11:20 PM
Missing Library Files jays337 UNIX for Dummies Questions & Answers 5 08-18-2005 05:23 PM
files missing cubicle^dweller UNIX for Dummies Questions & Answers 4 09-22-2003 12:10 PM
Having a Unix system installed side to side with Windows? Pcslider UNIX for Dummies Questions & Answers 14 01-29-2002 03:21 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-23-2006
Registered User
 

Join Date: Nov 2005
Posts: 27
Smile 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.
Reply With Quote
Forum Sponsor
  #2  
Old 06-23-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
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 With Quote
  #3  
Old 06-23-2006
Registered User
 

Join Date: Nov 2005
Posts: 27
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.
Reply With Quote
  #4  
Old 06-25-2006
Registered User
 

Join Date: Jul 2005
Posts: 32
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.
Reply With Quote
  #5  
Old 06-26-2006
Registered User
 

Join Date: May 2005
Posts: 19
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!!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0