Shell script to check the file sitting in the directory more than 10 hours


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Shell script to check the file sitting in the directory more than 10 hours
# 1  
Old 04-19-2016
Shell script to check the file sitting in the directory more than 10 hours

Hi,

I require shell script to check for any pending files which are sitting in the particular directory for more than 10 hours.

Please help me on this...Thank you.
# 2  
Old 04-19-2016
Hi,

What operating system are you using?

Have you tried anything yourself?

Gull04
# 3  
Old 04-19-2016
Hi,

I am using AIX operating system & no I haven't tried anything.
I need it from the scratch.
Thanks in advance.

KK.
# 4  
Old 04-19-2016
Find old files

Hi, the below script will search through specified directories and look for specified files. If any file is older than 10 hours a notification email will be sent.



Code:
#!/bin/ksh

OUT=/tmp/outfile.txt

find /dir1 -cmin +600 -name "file1" > $OUT

find /dir2 -cmin +600 -name "file2" >> $OUT

find /dir3 -cmin +600 -name "file3" >> $OUT




if [[ -s $OUT ]] ; then

mail -s "Check why listed files have existed for more than 10 hours " emailaddre
ss.com < $OUT

fi



Regards
Andy
# 5  
Old 04-19-2016
Hi..Thank you for the script.

But I no need of searching the directories,i have a directory in that list of file present & in that files sitting more than 10 hrs suppose to move destination directory.

I just want to get the output of the file more than 10 hrs - no mail required as well.

Thanks in advance.
KK
# 6  
Old 04-19-2016
We are not seeing much effort from your side, we are not here to do the work for you but here to help you ...
So explain what you are not able to do and show us what you have done so far
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell Script to check a file

I'm required to write a simple shell script that when it runs it writes the output which is a simple barcode to a tmp flat file which I can do the bit I'm struggling with... The next time it runs I need to check the tmp output file to see if that barcode is in the output file and if it is send... (5 Replies)
Discussion started by: worky
5 Replies

2. Shell Programming and Scripting

Send email if latest file in a directory is older than 2 hours

I have a objective of Sending email if latest file in a directory(excluding files of sub-dirs) is older than 2 hours. eg : ls -ltr drwx--x--x 2 abcde abc 256 2017-02-07 20:10 Mail -rw-rw-r-- 1 abcde abc 1170 2017-02-24 17:30 test -rw-rw-r-- 1 abcde abc 356 2017-03-09 18:00 xyz.csv... (3 Replies)
Discussion started by: simpltyansh
3 Replies

3. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies

4. UNIX for Dummies Questions & Answers

Need shell script to check file

Hi Experts, I am not good in writing script. Just stared.I am looking for shell script to check following parameters. 1) Number of files on remote Linux SUSE server.- Any directory and sub directory. 2) I should define number of files in script. Files should be variable. 3) Age of... (2 Replies)
Discussion started by: ApmPerfMonitor
2 Replies

5. Shell Programming and Scripting

How to check the duplicancy of file using shell script?

Hi all, i am getting the file through sftp from a location in the name of 20141201_file.txt (iam getting the file on daily basis with date appended at the beginning) so before going to my actual process ,i want to check whether today files and yesterday file are same or not(which i used to... (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

6. Shell Programming and Scripting

Shell scripting-I need a script which should watch a directory for a file with specific directory

I need a script which should watch a directory for a file with specific directory. If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column. The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies

7. Shell Programming and Scripting

How to check whether directory has files in it or not in shell script?

hi, I am having script in which i want to check if directory has any file in it or not. If directory contains a single or more files then and only then it should proceed to further operations... P.S.: Directory might have thousand number of files. so there might be chance of getting error... (4 Replies)
Discussion started by: VSom007
4 Replies

8. Shell Programming and Scripting

Check file created is less than 4 hours or not.

Hi, I need to check some files in one directory whether any files has been created before 4 hours(ie, less than 4 hours from the current time). Can anybody help me out..? Thanks in advance..! (21 Replies)
Discussion started by: Kattoor
21 Replies

9. Shell Programming and Scripting

check the file in multiple Directory in a script

hi, i want to write the script to list atleast one file inside that directory eg: /home/Log/amp01 /home/log/amp02 . . . /home/log/amp..N want to see atleast one file inside the /home/log/amp01 .... amp(N) if it not there.. need to give that no file exists inside... (3 Replies)
Discussion started by: mail2sant
3 Replies
Login or Register to Ask a Question