Search Files In Unix Servers


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Search Files In Unix Servers
# 1  
Old 08-20-2007
Bug Search Files In Unix Servers

hi all!

I am VB developer and i am trying to automate a process in UNIX for which i request your help.

I want to learn the technique by which we can write batch process in unix server to search for a list of files and to note down files that are missing from the list in the form of a log so that this log is mailed for notification of the specific file that is missing.

I do not know much about unxi except for very few basic commands.I request any help in this regard.

Thanks to this superb website !!
# 2  
Old 08-20-2007
You could..

1. enumerate through each file and see if it exists, if not append name to a file, after the enumeration if that file is not empty, then email it

or

2. have the list of files in sorted order, do a list of the directory, run that listing through "sort" then "diff" with the original list. If there is a difference, email the difference.
# 3  
Old 08-21-2007
first:
touch /directory/list1
touch /directory/list2
ls > directory/list1

then continually run this:

ls /directory/ > directory/list2
diff /directory/list1 /directory/list2 >> /logs/directorylog.log

If there is a difference between the lists then this will show up in the directorylog.log file.

Good luck scripting the mail commands and triggers. It should be fairly simple.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search files in UNIX based on execution

Hi, I have a UNIX script to fetch all the files for current day. so I am using code-- "files=($(find x.lst -maxdepth 1 -type f -daystart -mtime -1))". But this is not going to work if my job starts at 11 PM and continues till 1AM. In tht case I will loose all files between 11PM to 12AM. Is there... (3 Replies)
Discussion started by: usrrenny
3 Replies

2. Solaris

Need to transfer files between 2 UNIX servers, with same folder permission

I need to transfer directories/files between 2 Unix servers, with same folder permission. I tried scp, but it retains the the permissions, but changes the owner of the directory/file to the user used to copy them to the destination. I don't want that to happen. If possible without any other... (6 Replies)
Discussion started by: Pandee
6 Replies

3. Shell Programming and Scripting

Shell script to search a keyword in six different servers

Hello, I need a shell script which takes search keyword as input and then searches logs in six different servers and provide me the logs where in it found the keyword. Can anyone help???? (1 Reply)
Discussion started by: tomlui2010
1 Replies

4. SuSE

Search all files based on first and in all listed files search the second patterns

Hello Linux Masters, I am not a linux expert therefore i need help from linux gurus. Well i have a requirement where i need to search all files based on first patterns and after seraching all files then serach second pattern in all files which i have extracted based on first pattern.... (1 Reply)
Discussion started by: Black-Linux
1 Replies

5. UNIX for Dummies Questions & Answers

Copying files from unix servers to other locations e.g. C directory

Hi, I am just wondering is it possible to move or copy a file from a UNIX server to a different location e.g. the C drive on a computer? I have used the cp command to move files to different locations on unix servers but it would be handy to move a file to my C drive. I am currently... (3 Replies)
Discussion started by: crunchie
3 Replies

6. Shell Programming and Scripting

unix servers

hi, anyone please explain ab the unix servers thanks in advance Satya (2 Replies)
Discussion started by: Satyak
2 Replies

7. UNIX for Advanced & Expert Users

Search files with specfic extention and later search content

Hi, I would appriciate if somebody can help me figure out how to search for all the *.xml file under a specific directory and subdirectroies (/home/username) and later search of content "<start>" inside the xml file returned by search. -Lovin.V (2 Replies)
Discussion started by: lovi_v
2 Replies

8. UNIX for Dummies Questions & Answers

re-associating 2 HP UNIX servers

Hello, i am new to both this forum and UNIX as well; i am working at a local cancer center trying to reassociate 2 UNIX server systems that i am unfamiliar with; Both C3600 workstations were associated, however they were disassociated and need to be reassociated so programs can be accessed on... (0 Replies)
Discussion started by: RarisRSX
0 Replies

9. HP-UX

Bouncing Unix Servers

Hi there, I was wondering if any of you good people out there could answer these question: A - why Unix servers are bounced once a in while in commercial environments? B - in what circumestances Unix Server are bouced? Many thanks for your time. Kind regards MH (17 Replies)
Discussion started by: mhossien
17 Replies
Login or Register to Ask a Question