find how many files are in use in a folder


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find how many files are in use in a folder
# 1  
Old 01-22-2009
find how many files are in use in a folder

How can i find how many files are in use in a folder or its sub folders in unix i tried with fuser .. but i coulnt getting ...
# 2  
Old 01-22-2009
Not sure why you'd want to do this, but you could attempt to use 'find' with one of the access time options, but I don't believe that this will be anywhere near foolproof.
Code:
find . -atime -1 -ls

should list all files in the directory tree accessed within the last day. GNU find has an -amin option that deals in minutes rather than days.

In Perl, you can descend the tree and 'stat' each file to get its access time.

Jerry
# 3  
Old 01-22-2009
I believe that the utility that you are looking for is called "lsof"
# 4  
Old 01-22-2009
I've been using Unix in various different flavours for a large number of years, but I've never come across 'lsof' before. It's always a good day when you learn something! Thanks avronius!Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find common lines between all of the files in one folder

Could it be possible to find common lines between all of the files in one folder? Just like comm -12 . So all of the files two at a time. I would like all of the outcomes to be written to a different files, and the file names could be simply numbers - 1 , 2 , 3 etc. All of the file names contain... (19 Replies)
Discussion started by: Eve
19 Replies

2. Shell Programming and Scripting

Find common lines with one file and with all of the files in another folder

Hi! I would like to comm -12 with one file and with all of the files in another folder that has a 100 files or more (that file is not in that folder) to find common text lines. I would like to have each case that they have common lines to be written to a different output file and the names of the... (6 Replies)
Discussion started by: Eve
6 Replies

3. Shell Programming and Scripting

find command to move the files to other folder - ksh 88

Hi , I've learnt that the following command will remove the files from the given folder for given no.of days find /home/etc -type f -atime -10 -exec rm -f {} \; But how can I change the above command that will move the files to another specified directory instead of removing the... (1 Reply)
Discussion started by: smile689
1 Replies

4. Shell Programming and Scripting

Find and replace folder of files with $var

I want to scan through all the files in the folder and replace all instances of $file_X within the file with the variable $X defined in my bash script on my debian 6.0 install. For example, if the file contains $file_dep I want it to be replaced with the value of the variable $dep defined in my... (1 Reply)
Discussion started by: Spadez
1 Replies

5. HP-UX

How can I find the size of files added to a folder after a particular date

Hi, I want to find the size of the files added to a folder after a certain date(say 1st of october), I know we can list the files which were created after a certain date , but is there anyway to find the total size of those files ? (3 Replies)
Discussion started by: alookachaloo
3 Replies

6. UNIX for Dummies Questions & Answers

find files on first level folder

Hi: I have: folderA |----folderB |----folder1 |----folder2 |----folder3 |----folder3.1 Question: How can I find *.txt ONLY from /folderA/folderB/ and not the others folder1,2,3?? I tried: find... (8 Replies)
Discussion started by: iga3725
8 Replies

7. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. I´m trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

8. UNIX for Dummies Questions & Answers

To find files with specific dates and cp another folder.

Hi all, We have an existing script: find /u03/oraprod/perpcomn/admin/out -type f -ctime +7 \ -exec cp {} "/u08/oraprod/backup/cout" \; Which is to find all files more than 7 days and copy to another folder. However I would like to only list files with Sep 29, and cp to another folder. ... (2 Replies)
Discussion started by: *Jess*
2 Replies

9. Shell Programming and Scripting

How to find files in current folder only?

How do I find files in current folder only? We are on AIX 5.3, so maxdepth is not supported. I tried to do this find /dir1/dir2/dir3/dir4 -prune -type f to display all files in /dir1/dir2/dir3/dir4 only but it does not show any files. Somehow the -prune option works for dir3 level... (7 Replies)
Discussion started by: Hangman2
7 Replies

10. Shell Programming and Scripting

Shell script to find out 2 last modified files in a folder..PLZ HELP!!!!!!!!!

hi all, I need to find out the last 2 modified files in a folder.There is some way by which,we can check the timestamp and find out..??please help this is urgent. Thanks in Advance Anju (3 Replies)
Discussion started by: anju
3 Replies
Login or Register to Ask a Question