LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 07-13-2017, 08:38 AM   #16
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364

Maybe use/add the 'd' (don't descend dirs) switch to the ls -l: ls -ld {}
Quote:
-d, --directory
list directories themselves, not their contents
 
Old 07-13-2017, 02:07 PM   #17
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Distribution: Mint/MATE
Posts: 3,010

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
-mtime works with days.
-mtime -1 means less than a day and in the future (unlikely but possible).
-mtime 0 means less than a day but not in the future.
You can also look at the ls options.
As was suggested by the previous post, the -d option lists a directory itself, not its contents.
Code:
find . -mtime -1 -exec ls -ld {} \;
And for better speed (less forks)
Code:
find . -mtime -1 -exec ls -ld {} +
 
Old 07-14-2017, 09:54 PM   #18
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
deleted

Last edited by tofino_surfer; 07-15-2017 at 02:03 PM.
 
1 members found this post helpful.
Old 07-15-2017, 05:29 AM   #19
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
I'm not sure how you've arrived at the conclusion that -1 does no filtering. I think you should have read some of the posts in the thread (such as #8 and #17). The reason why you think -mtime -1 does no filter is that you've added "-exec ls -l {} \;", without adding (that's one way to solve it) -type f (because the dot is interpreted as a directory, and ls is applied to the dot again). So you're having the same problem I was having when I opened this thread. And this problem is solved. And you think it's not

Try find . -mtime -1 and you'll understand that -1 does filter. And read the post that was written right before yours.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to use 'grep' for files found from 'find' .. susja Linux - Newbie 32 06-24-2016 12:28 AM
Find command - alert on files not found SmurfGGM Linux - General 3 06-13-2014 09:22 AM
find found files that don't exist? mocax Linux - Newbie 3 12-08-2010 07:13 AM
How to find a file and just list the found files? thomas2004ch Linux - Newbie 4 08-07-2009 05:54 AM
How to find files and copy the found files to the floppy in one command justmehere Linux - Newbie 11 05-05-2008 12:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration