The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 02:44 PM
How to print two sql query outputs side by side in excel prasee Shell Programming and Scripting 6 09-08-2007 02:20 AM
Missing Library Files jays337 UNIX for Dummies Questions & Answers 5 08-18-2005 08:23 PM
files missing cubicle^dweller UNIX for Dummies Questions & Answers 4 09-22-2003 03:10 PM
Having a Unix system installed side to side with Windows? Pcslider UNIX for Dummies Questions & Answers 14 01-29-2002 06:21 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-23-2006
Nayanajith Nayanajith is offline
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.
  #2 (permalink)  
Old 06-23-2006
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,952
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 (permalink)  
Old 06-23-2006
Nayanajith Nayanajith is offline
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.
  #4 (permalink)  
Old 06-25-2006
mhbd mhbd is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 34
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 (permalink)  
Old 06-26-2006
bobbyjohnz bobbyjohnz is offline
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!!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0