How to find a file which is being written recently in directory of 1000 files?
How to find a file which is being written recently in directory of 1000 files?
|
Code:
find -mmin '-5' |
cd to the directory and execute this: find ./ -name "name of the file" -mtime -7.
1) better write the name of the file in the codes. 2) -mtime -7 will find files modified seven or fewer days ago. you can change the parameter. cheers. |
if you know a part of the name or the extension (.txt, .zip, ...)
try something like Code:
find -mmin 5 | grep *.txt (because you said how to find A file, you can either try my suggestion or one of the above ;)) GL :hattip: |
You can also cd to the directory and type:
ls -lt | more |
Quote:
Code:
ls -lt | less |
Go inside the directory and try find ./ -name "filename", or find ./ -name "filename*"( if you do not the file extension ) . If you know how many days ago was the file was last edited, you can try find ./ -mtime 1 (or 2,3,4,5,etc the number represents how many days prior to the currect date). You can also try grep -r filename ./
|
Another technique that might be useful
Code:
$ touch /tmp/now Code:
$ find /path/to/directory -newer /tmp/now |
Thanks arizonagroovejet!
|
Recently is a problem
I see you guys pretty much answered but let me add my 5 cents. You need to have idea how recently you want it to be. If you have an idea that it is 0-10 days ago you can generate a report like this:
Code:
# for i in {0..10};do echo "$i days ago:" ;find . -mtime $i ;done; |
All times are GMT -5. The time now is 03:57 AM. |