shell script to get the arrival count of file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script to get the arrival count of file
# 1  
Old 08-20-2009
shell script to get the arrival count of file

Hello All,

I have come across a small problem. It would be great if any of you could help me in resolving the issue.

one file named dummy.txt will be ftped to Unix machine twice daily. If i receive it second time in a day i need to do some processing with the file.


How to find the number of times it arrived to Unix box?

Please help me by giving some ideas?

Thanks
# 2  
Old 08-20-2009
What do you mean?
If ftped twice a day, sure you will receive it a second time... or that is not what you ment...
Should we understand the file can be resent later independently of the 2 daily occurences?
# 3  
Old 08-20-2009
Ad hoc (assumed you'll remove the processed file),

- you may want to create and schedule (cron) a script, which
- on a regular base checks for the file in question ('if -f file'),
- stores it's details ('ls -l file') to a status file ('> status_one'),
- if status_one exists, compares the current file's details to those stored,
- if different, processes the current file and finally removes the status file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script Shell: Count The sum of numbers in a file

Hi all; Here is my file: V1.3=4 V1.4=5 V1.1=3 V1.2=6 V1.3=6 Please, can you help me to write a script shell that counts the sum of values in my file (4+5+3+6+6) ? Thank you so much for help. Kind regards. (3 Replies)
Discussion started by: chercheur111
3 Replies

2. Shell Programming and Scripting

File Count Based on FileDate using Shell Script

I have file listed in my directory in following format -rwxrwxr-x+ 1 test test 4.9M Oct 3 16:06 test20141002150108.txt -rwxrwxr-x+ 1 test test 4.9M Oct 4 16:06 test20141003150108.txt -rwxrwxr-x+ 1 test test 4.9M Oct 5 16:06 test20141005150108.txt -rwxrwxr-x+ 1 test ... (2 Replies)
Discussion started by: krish2014
2 Replies

3. UNIX for Dummies Questions & Answers

Script shell calculate mean arrival request duration

hello, I have implemented this command : tshark -eth0 -T fiels -e frame.time et sip.Request-Line -z sip,stat > test2.txt the result of this command : test.txt: Aug 27, 2013 23:06:47.334270000 INVITE Aug 27, 2013 23:06:47.335045000 SIP/2.0 401 Unauthorized Aug 27, 2013... (1 Reply)
Discussion started by: Amouna
1 Replies

4. Shell Programming and Scripting

Validate file count in korn shell script

Hi, I have files in the directory like below which I need to validate if all the required files are present. A_B_001 of 002_time1.txt A_B_002 of 002_time1.txt A_B_001 of 001_time2.txt Scenarios- a)If file with 001 of 002_time1 or 002 of 002_time1 is missing in the folder,script should... (6 Replies)
Discussion started by: aneeta13
6 Replies

5. Shell Programming and Scripting

Print record count of a file using shell script

HI, I need to print the record count of a file using shell script. If the record count of a file excluding header and trailer record if greater than zero then print 'Record count of a file is xxxx records'. If the record count is zero print 'zero records' Thanks Mahendra (1 Reply)
Discussion started by: mmeda
1 Replies

6. Shell Programming and Scripting

Need File arrival time(sftp) command

Hi All, I am getting some file through using sftp from another server to my server. I want know the exact file arrival time on my sytem I have tried stat command . it gives me the below details $ stat abc.txt File: `abc.txt Size: 24231 Blocks: 48 IO Block:... (5 Replies)
Discussion started by: aish11
5 Replies

7. Shell Programming and Scripting

Hit count on a shell script

I have a unix shell script (ex.sh) written. How to find out how many users (incl. myself) have run this .sh ? I can insert code snipet at top of script if need be. - Ravi (2 Replies)
Discussion started by: ravi368
2 Replies

8. Shell Programming and Scripting

count multiple objects in shell script

Hi all: Trying to count the number of oracle instances on HPUX 11.23 - using ksh. I have multiple instances running and I would like to have a count for how many processes for each instance. Example, run the 'ps -efu oracle' command and for each instance increment a counter. So I am looking for... (4 Replies)
Discussion started by: raggmopp
4 Replies

9. Shell Programming and Scripting

need to invoke a script upon arrival of a file

hi all, i recieve a file from other server, on a daily basis .... but the time of arrival is unpredictable .... i need to move this file to another directory before the next file arrives ... i have written a script that does this op and performs some manipulations on the data... but i... (2 Replies)
Discussion started by: sais
2 Replies

10. Shell Programming and Scripting

File arrival status

If there is a file being transferred from one box to another box, How can one confirm on the 2nd box..that the file has arrived, and transfer is complete ? I mean in addition to checking the file exists, I want to confirm its transferred completely and not growing in size. (4 Replies)
Discussion started by: amsh76
4 Replies
Login or Register to Ask a Question