How to list the files based on the modification time using the find command?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to list the files based on the modification time using the find command?
# 1  
Old 03-06-2012
MySQL How to list the files based on the modification time using the find command?

Hi All,

I need to list the files based modification time of the files from a directory, I cannot use "ls -t" as there are lot of files, which "ls" command cannot handle. New files will land there daily. So iam looking for an alternative through "find"command.

All suggestions are welcomed.

Thank you.Smilie
# 2  
Old 03-06-2012
find is not a "go-faster ls". It uses the same readdir() calls, etc, that ls does.

So, if it's too many files for ls to handle, you are in trouble. You're choking your filesystem with too many millions of files in the same folder, something no filesystem handles well, and it will only get worse.

You'll need to reorganize in some way, methinks, so you don't have thousands of files in the same folder, and/or keep a log of when files arrive.
# 3  
Old 03-06-2012
https://www.unix.com/unix-dummies-que...d-command.html

I got involved in a discussion on this subject recently. See above link.
# 4  
Old 03-06-2012
What Operating System and version you you have and what Shell do you use?


Quote:
I cannot use "ls -t" as there are lot of files, which "ls" command cannot handle
How many files?
Can you demonstrate this problem?

Quote:
I need to list the files based modification time of the files from a directory,
What does this sentence mean? Can you give an example?
# 5  
Old 03-06-2012
Quote:
Originally Posted by methyl
What Operating System and version you you have and what Shell do you use?



How many files?
Can you demonstrate this problem?


What does this sentence mean? Can you give an example?
Code:
How many files?
Can you demonstrate this problem?

The files will be small in size say 2kb and the files will cleared after the size of the directory reaches some point. The number of files in the directory might be 3500 to 4000 files or may be more than that.

Code:
What Operating System and version you you have and what Shell do you  use?

uname -o
GNU/Linux
This is a VMware server..
# 6  
Old 03-06-2012
Your number of file is not too many for "ls".

Please explain what you are trying to do.
# 7  
Old 03-06-2012
Agreed, 4,000 files is not a lot.

40,000 would be getting there.

400,000 would be a big problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find list of missing files based on the file format?

Hi All, In the file names we have dates. Based on the file format given by the user, if any file is not existed for a particular date with in a given interval we should consider that file is missing. I have the below files in the directory /bin/daily/voda_files. ... (9 Replies)
Discussion started by: nalu
9 Replies

2. Shell Programming and Scripting

Setting read only based on modification time

Hi all first a setup scenario create 3 files with modification date 1, 2, and 3 days ago as stated in the find line it should only do something to the files 2 and 3 days old find . -mtime +2 works fine and only displays the 2 files but running the entire line sets all files to read only. i... (3 Replies)
Discussion started by: masterdraco
3 Replies

3. AIX

Getting files through find command and listing file modification time upto seconds

I have to list the files of particular directory using file filter like find -name abc* something and if multiple file exist I also want time of each file up to seconds. Currently we are getting time up to minutes in AIX is there any way I can get file last modification time up to seconds. (4 Replies)
Discussion started by: Nitesh sahu
4 Replies

4. Shell Programming and Scripting

List Files Based On Time & Date

Hi All, I am using HP Unix. I want to list files which are created 5 minutes before on the same day as well as before today's date. I checked all the forums and the commands provided there does not work on HP Unix. Can you please help me on this? Your help is highly aprreciated. Thanks and... (3 Replies)
Discussion started by: angshuman
3 Replies

5. Shell Programming and Scripting

Ls ignoring files from their modification time

Hi everyone, I'd like to know if is there a way to list files but ignoring some according to their modification time (or creation, access time, etc.) with the command 'ls' alone. I know the option -I exist, but it seems to only looking in the file name.. Thank you in advance for the... (8 Replies)
Discussion started by: Keyhaku
8 Replies

6. Shell Programming and Scripting

Find and symbolic link modification time

Hi, I have a directory made up of many symbolic links to folders multiple file systems. I want to return folders modified within the last 50 days, but find is using the link time rather than the target time. find . -type d -mtime -50 Is there a way to either: a) Make a symbolic link... (1 Reply)
Discussion started by: earls
1 Replies

7. Shell Programming and Scripting

Archive Files over certain modification time

Environment is cygwin on Windows Server 2003 as I could not think how I would achieve this using Windows tools. What I want ot achieve is the following. I have a Directory D:\Data which contains further subfolders and files. I need to move "files" older than 6 months modification time to... (4 Replies)
Discussion started by: jelloir
4 Replies

8. Shell Programming and Scripting

ls -e to find out File modification time in secs

Hi All, I would like to know the file modification time till seconds in Unix. So I tried ls -e and it worked fine. This Solaris 5.10 -rw-rw-r-- 1 test admin 22 Sep 12 11:01:37 2008 test_message But I am not able to run the same command in SOlaris 5.6 and also in AIX/HP Is there... (3 Replies)
Discussion started by: rahulkav
3 Replies

9. UNIX for Advanced & Expert Users

Find and store files based on FileName and Modified Time

Hi, I am currently using the following command: files=(ls enuCPU??.????.exp ntuCPU??.????.exp) I need to now change the commmand to store the file names of files that have been modified before datetime equal to say '02/16/2008 20:30:00' What could I use? (2 Replies)
Discussion started by: edisonantus
2 Replies

10. UNIX for Advanced & Expert Users

Find files based on time

Hi, Whats the command for finding files older then 20mins. This has to be part of the find command as it will be part of a cleanup script. thanks Budrito (4 Replies)
Discussion started by: budrito
4 Replies
Login or Register to Ask a Question