|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi experts,
I Need to print file names in a certain date range using ls . Please help me with any sample script. Thanks a lot in advance.Regards, Satish |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
If your find command has the capability to find files by age, you can use that. It's a bit tricky if you haven't used it before, but this site is full of examples. Start with the FAQ: http://www.unix.com/answers-frequent...d-command.html
|
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
Thanks for quick reply. But my requirement has changed...i want a command instead of a script which can compare the files and list them with in a given date range. Actually am invoking this command in my service and i will supply two dates as my input and my output shud be a list of files. Please help me. |
|
#4
|
||||
|
||||
|
try Code:
ls -lt list files in date order or Code:
ls -ltr list files in reverse date order From these, your could add a grep to select a specific month in instance. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
#!/bin/ksh
################################################# ## File: findDateRange.sh ## Date: May 27, 2008 ## Author: Saurav Sen ## Purpose: A script to find the files within ## a given date range ################################################# echo "You have to provide the path, start date and the end date" echo echo "Enter the path to start search" read fpath echo "Please enter the start date in the format YYYYMMDD" read strtdt echo "please enter the end date in the format YYYYMMDD" read enddt touch -t ${strtdt}0000 /tmp/newerstart touch -t ${enddt}2359 /tmp/newerend #find ./ \( -newer /tmp/newerstart -a \! -newer /tmp/newerend \) -print find $fpath \( -newer /tmp/newerstart -a \! -newer /tmp/newerend \) -exec ls -l {} \; |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using 'date' to list a range of dates | TAPE | Shell Programming and Scripting | 4 | 10-14-2010 04:43 PM |
| List files with Date Range and Zip it | nokiak810 | Shell Programming and Scripting | 2 | 08-01-2010 01:47 AM |
| How to list file names instead of lines when grep a gzcat command? | HugoH | UNIX for Dummies Questions & Answers | 2 | 07-14-2009 05:56 PM |
| Command to list directory names only | stevefox | UNIX for Dummies Questions & Answers | 6 | 11-29-2007 07:06 PM |
| Need to print file names in a certain date range using ls | Shamwari | UNIX for Dummies Questions & Answers | 2 | 10-08-2001 07:14 PM |
|
|