Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi...when multiple subdirectories are under a main directory, how can I find only new files i.e from last 1 are two days modified or new files . Hope someone will definetely help this.
Regards
Niharika
Click here to see the post LQ members have rated as the most helpful post in this thread.
As you said I did as "find /home/my_home_dir -mtime +1 -print", But it is giving around 1442 files information which is also included .Mozilla, .thunderbird, .thumbnail, .metacity files, I don't want these files info. So how can I exculde these hidden directories info, And what does +1 means in this command? Is it since last one day?
it [...] included .Mozilla, .thunderbird, .thumbnail, .metacity files, I don't want these files...
You can exclude these files by having ./* as your search path:
Code:
find ./* -mtime +1
You can omit -print as it's used by default.
The +n means the files are at least n*24 hours old: with n=1, it's at least (more than) 24 hours old, or at least 2 days old.
Note that the solution I mentioned only excludes the 1st-level entries, meaning the hidden directories and files in the main search directory won't be included.
So to exclude ".mozilla", ".metacity" and so forth, you use what I wrote before:
Code:
find ./* -mtime +1
This is effectively searching everything non-hidden in the main directory.
However, if you have hidden entries INSIDE the non-hidden, 1st-level entries, they will still be listed.
To exclude hidden matches (if you don't want hidden files to be shown in your search query), you can additionally use the -not -name modifier:
Yes you are correct, But now if I used "find ./* -mtime +1", But it is showing all old files older than a day, but excuding hidden directories.
But I need new files of last one or two days. So I ran "-1" instead of "+1" & found only new files which are belongs to since last 24 hours.
Anyway Thank you very much for your kind help.
Quote:
Originally Posted by paulmarc
You can exclude these files by having ./* as your search path:
Code:
find ./* -mtime +1
You can omit -print as it's used by default.
The +n means the files are at least n*24 hours old: with n=1, it's at least (more than) 24 hours old, or at least 2 days old.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.