Results 1 to 9 of 9
I know how to find and display file by modification time by (ls –g –t)
but is there any way to put number of day from this specific number what ...
- 07-29-2007 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 31
How to display file by specific input period of time ?
I know how to find and display file by modification time by (ls –g –t)
but is there any way to put number of day from this specific number what is the modification in this specific period
for example if I put 30 it will display all file in last 30 day(month)
can you help me please ?
- 07-29-2007 #2Linux User
- Join Date
- Jul 2004
- Location
- Poland
- Posts
- 368
Try "find -mtime -n" where n is the number of days, like find -mtime 30 in your example.
"I don't know what I'm running from
And I don't know where I'm running to
There's something deep and strange inside of me I see"
- 07-29-2007 #3Just Joined!
- Join Date
- Jul 2007
- Posts
- 31
iIt work but it does s not display like “ls” how I convert it to display like list
It work but it does s not display like “ls” how I convert it to display like list I mean column by column
- 07-29-2007 #4Linux User
- Join Date
- Jul 2004
- Location
- Poland
- Posts
- 368
Pipe the output of find to ls -lg, for example:
(the xargs reads its input and appends the lines after the ls -tg, so that the ls will be invoked with files from find as its arguments). I'm not sure if it handles the subdirectory the way you want them.Code:find -mtime -1 | xargs ls -tg
"I don't know what I'm running from
And I don't know where I'm running to
There's something deep and strange inside of me I see"
- 07-30-2007 #5Just Joined!
- Join Date
- Jul 2007
- Posts
- 31
Thanks Mr. Kyku I appreciate your help but unfortunately it does not work properly
Thanks Mr. Kyku I appreciate your help but unfortunately it does not work properly
When I Pipe the output of find to ls -lg it will not consider the input Number it will sort All file regardless input number for example when I put
find -mtime -30 | xargs ls -tg
It gives me all file from 2007, 2006, 2005......2000 and so on.
Which is not handles what I want I mean it should display only file in the period from
30 days (1 month) like from 30 May until now 30 July
Also it is not handles subdirectory the way I want them. It sort only file in the same subdirectory but I want all file from all subdirectory to be arranged together
- 07-31-2007 #6Just Joined!
- Join Date
- Jul 2007
- Posts
- 31
#!/bin/csh -f
echo "" > tmpfile
foreach priod ( 720 580 360 270 180 90 )
set fsize = `find -mtime priod | xargs ls -tg | awk '{ size += $4 } END {print size}' `
echo " ${priod} ${fsize}" >> tmpfile
end
end
find: invalid argument `priod' to `-mtime'
find: invalid argument `priod' to `-mtime'
find: invalid argument `priod' to `-mtime'
find: invalid argument `priod' to `-mtime'
find: invalid argument `priod' to `-mtime'
find: invalid argument `priod' to `-mtime'
end: Not in while/foreach.
- 07-31-2007 #7Linux User
- Join Date
- Jul 2004
- Location
- Poland
- Posts
- 368
"I don't know what I'm running from
And I don't know where I'm running to
There's something deep and strange inside of me I see"
- 08-01-2007 #8Just Joined!
- Join Date
- Jul 2007
- Posts
- 31
It is ok now but gove me wrong answare calculation is not right
It is ok now but gove me wrong answare calculation is not right
I made this modification
#!/bin/csh -f
echo "" > tmpfile
foreach priod ( 720 580 360 270 180 90 )
set fsize = `find -mtime ${priod} -type f | xargs ls -tg | awk '{ size += $4 } END {print size}' `
echo " ${priod} ${fsize}" >> tmpfile
end
- 08-01-2007 #9Just Joined!
- Join Date
- Jul 2007
- Posts
- 31
echo "" > tmpfile
foreach priod ( 720 580 360 270 180 90 )
set fsize = `find -mtime ${priod} -type f | xargs ls -tg | awk '{ size += $4 } END {print size}' `
echo " ${priod} ${fsize}" >> tmpfile
end


Reply With Quote
