Checking if any folder is opened or not?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Checking if any folder is opened or not?
# 1  
Old 09-10-2008
Checking if any folder is opened or not?

Alogorithm:
=============
Whenever any user open any specific directory:
1) cd /usr/lib

The prompt should show an Alert message like
2) echo "You have opened this folder"


How should I write shell script this one?..

It should be irrespective of users and
continuously run in the background; checking whether the folder is opened or not?

Waiting for your suggestions...Smilie
# 2  
Old 09-10-2008
If you are on Linux, check out inotify.
# 3  
Old 09-10-2008
No i am using UNIX ksh..
# 4  
Old 09-10-2008
lsof or fuser
# 5  
Old 09-10-2008
[/users/css]lsof
/usr/bin/ksh: lsof: not found

[/users/css]fuser
/usr/bin/ksh: fuser: not found
# 6  
Old 09-10-2008
What OS?

You may have to download the version for your OS... It is not native but open source (lsof that is...)
And fuser is normally in /usr/sbin (or /sbin..)
# 7  
Old 09-10-2008
Learning the Korn Shell: Unix ... - Google Book Search has a sort of suggestion for this.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help Needed for creating the folder by checking today's date and, take backup using rsync command

How to create a shell script to create a folder by using the today's date to take backup using rsync command on every evening around 7 pm. Kindly help. Thanks. To be more precise, I want to create a script which matches the today's date with server's date format, if matches then creates the... (2 Replies)
Discussion started by: bakula10
2 Replies

2. Shell Programming and Scripting

Checking MD5 Hashes on a folder tree

Hi Guys, I have a backup program that creates incremental backups and generates a MD5 hash at the same time. Each server backup has its own sub folder. Each backup file has a corresponding .md5 file containing a hash and a file name like this. 3410efed13b087322de8036145230a55... (6 Replies)
Discussion started by: Pollardd
6 Replies

3. Shell Programming and Scripting

Checking of file exist in different folder

Hi All, Seeking for your assistance to compare if the file in working directory is found on the DIR2 directory and if not found move the file in DIR2. ex. WORKING_DIR=/home/dir1/ file1.txt DIR2=/home/admin/users file1.txt what i did was found_nonempty='' for file in... (4 Replies)
Discussion started by: znesotomayor
4 Replies

4. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

5. UNIX for Dummies Questions & Answers

Script for checking the files in a folder

Hi , I am using the below script for checking for a file in a folder. if ; then echo 0 else echo 1 fi Is there any way we can check for files which are starting with GL*.csv.What I am trying to do is , I have to check in a folder for the GL*.csv files if there are any files they I... (6 Replies)
Discussion started by: wangkc
6 Replies

6. Shell Programming and Scripting

Checking files in folder using starting string for filename

Hi, How do i check if there are any files present in the folder with some specific starting string. For eg :- I have used this where Source_File is filename parameter. if then return 2 fi But in my case the source file name is not constant. The only constant thing is... (10 Replies)
Discussion started by: chetancrsp18
10 Replies

7. Web Development

Checking if a folder is empty or not using PHP

Hi, I am sharing this tip with you all.The codes given below will explain /** * Checking a folder is empty or not. * @param string $folderName * $folderName should be folder name or path * @return TRUE/FALSE (If any file or folder found/Empty folder) */ function... (1 Reply)
Discussion started by: elizas
1 Replies

8. Shell Programming and Scripting

The checking of folder existance is not working...

Hi all, I have the following code: if ; then echo 'folder not exist'; else echo 'folder exist'; fi The "testing" folder is not exist in /home/batch , but thhe result is 'folder exist'. It seems that the code cannot detect that the folder "testing" not exist. ANybody know the... (1 Reply)
Discussion started by: suigion
1 Replies

9. Shell Programming and Scripting

Continously checking folder and executing files

Hello All, I want to make a script which continously checks one folder all the time that is there is any file in it or not, and if it found any file in it than execute that file with the following command. apxrcv -text < filename > outputfile Actually my requirement is that i will put... (4 Replies)
Discussion started by: wakhan
4 Replies

10. UNIX for Dummies Questions & Answers

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... (4 Replies)
Discussion started by: Nayanajith
4 Replies
Login or Register to Ask a Question