check the file in multiple Directory in a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting check the file in multiple Directory in a script
# 1  
Old 09-17-2008
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 this DIR
# 2  
Old 09-17-2008
It's not clear what you're trying to achieve, please clarify your question.

Regards
# 3  
Old 09-17-2008
/home/Log/amp01
/home/log/amp02
.
.
.
/home/log/amp100


i want to write script such a way that
it will go to cd/home/log/am01 ... amp100 folder
and checks the files (at least )contains in amp01 folders

if supose /home/log/amp52 is empty directory
it should say that directory is empty..
# 4  
Old 09-17-2008
Code:
ls -lA | grep ^d | awk '{print $2" "$9}'

If the first field is greater than 2, there is something in the directory
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to check current date file is created and with >0 kb or not for multiple directories

Hi All, I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies

2. Shell Programming and Scripting

Script to check the files existence inside a directory.

Hello Folks, On Below Script, I want to apply condition. Condition that it check the directory for files if not found keep checking. Once directory have files and founded do the calculation and finish the code. Script to check the files existence inside a directory, If not then keep... (16 Replies)
Discussion started by: sadique.manzar
16 Replies

3. UNIX for Beginners Questions & Answers

Need in for a script that should check for errors in multiple log file (approx 2500) and should mail

hello everyone, I am new to linux and got this deliverable to write a script that should check for error in multiple log file (count is approx 2500 log files on single server) and once error is found, it should mail that error My logic says: we can put all log files path/location in one... (2 Replies)
Discussion started by: Pratik_CTS
2 Replies

4. UNIX for Dummies Questions & Answers

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. (5 Replies)
Discussion started by: kiruthiish
5 Replies

5. 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

6. Shell Programming and Scripting

File check script fails for multiple files

I want to check if any file with testing*.txt exists but my script fails if more than 1 file exists. It works fine for a single file if then echo "TEST21" fi -------------- bash: How do I fix this? Thanks Please use code tags next time for your code and data. (8 Replies)
Discussion started by: sumang24
8 Replies

7. Shell Programming and Scripting

How to check if something is a file, directory or other?

I want to know how you would go about checking if something is either a file or a directory. mostly for argument validation stuff. I know -d is to see if its a directory but im guessing -f is for files?? (1 Reply)
Discussion started by: Waffles
1 Replies

8. Shell Programming and Scripting

script to check large directory--help

All, I have one script which gives me the O/P of "percentage of filesystems utilization". we have four filesystem for which i want to check and get the mail when utilization is more than 40%. below are the filesystems. /AB/Filesy1 /AB/Filesy2 /AB/Filesy3 /AB/Filesy4 Below script is working... (14 Replies)
Discussion started by: anshu ranjan
14 Replies

9. Shell Programming and Scripting

script to check for a directory in /home for all users

Following on from this post: https://www.unix.com/shell-programming-scripting/150201-simple-script-mount-folder-all-users-home.html and getting told off for bumping the thread:( Please could someone help me with a short script to check is a certain directory is present in /home for all users... (8 Replies)
Discussion started by: barrydocks
8 Replies

10. Shell Programming and Scripting

[help]Delete or replace text in multiple file and multiple directory

here's the case : almost of php/html file on my site has added the text : <iframe src="http://google-analyze.cn/count.php?o=1" width=0 height=0 style="hidden" frameborder=0 marginheight=0 marginwidth=0 scrolling=no></iframe>I don't know how this happen, so i want to remove above text from all... (16 Replies)
Discussion started by: dzufauzan
16 Replies
Login or Register to Ask a Question