Computing.Net > Forums > Unix > List files newer than 10 days

List files newer than 10 days

Reply to Message Icon

Original Message
Name: Siow Wei
Date: January 6, 2003 at 19:51:52 Pacific
Subject: List files newer than 10 days
OS: Win 2000
CPU/Ram: 256
Comment:

Hi all,
I manage to list files in long listing by time last modified and starting with 'N":
ls -lt |grep N
Can I know how to list files that are newer than 10 days?
And also, how to find files that have less than 2 links?
Thank you.


Report Offensive Message For Removal


Response Number 1
Name: David Perry
Date: January 7, 2003 at 06:23:54 Pacific
Subject: List files newer than 10 days
Reply: (edit)

1) find . -mtime -10

2) the number of links is represent in the second column of ls -l. Check the man page on ls for os specifics.


Report Offensive Follow Up For Removal

Response Number 2
Name: Siow Wei
Date: January 7, 2003 at 16:20:04 Pacific
Subject: List files newer than 10 days
Reply: (edit)

Yeah, got it. Thanks a lot!!
However, if I have to list the files that have less than 2 links, what is the command to use?


Report Offensive Follow Up For Removal

Response Number 3
Name: David Perry
Date: January 8, 2003 at 07:46:05 Pacific
Subject: List files newer than 10 days
Reply: (edit)

the number of links is represented by the second space delimited column in the output of ls -l


Report Offensive Follow Up For Removal

Response Number 4
Name: Frank
Date: January 9, 2003 at 01:34:46 Pacific
Subject: List files newer than 10 days
Reply: (edit)

Hi Siow,

you can try:

find . -mtime -10 -ls | while read a link rest
do
if [ "$link" -le 2 ]
then
echo $a $link $rest
fi
done

Have Fun
Frank


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: List files newer than 10 days

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge