![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Get date and time for past 1 hour from current date | spch2o | Shell Programming and Scripting | 5 | 08-29-2008 04:32 AM |
| how to check whether the given file is 5 weeks older than current date | risshanth | Shell Programming and Scripting | 1 | 10-29-2007 04:53 AM |
| Moving multiple files and renaming them on the fly | daemongk | Shell Programming and Scripting | 1 | 06-08-2007 01:36 PM |
| moving and renaming multiple files | rocinante | Shell Programming and Scripting | 1 | 06-07-2007 08:20 PM |
| Renaming files to have date/time in filename | wayneb | UNIX for Dummies Questions & Answers | 5 | 01-19-2005 10:49 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi,
I have a very urgent requirement here. I have to find all files in the specified directory but not in the sub directories(The directory name is stored in a variable) which are older than the current date as well as current time and rename it as filename_yyyymmddhhmmss.ext and move it into a different folder(which is also stored in a variable). I am using solaris 5.8. Here "yyyymmddhhmmss" refers to the date and time the corresponding file was created. And when i try to use "stat filename" i get Ksh: not found error Last edited by ragavhere; 11-20-2008 at 11:03 AM.. |
|
||||
|
Are you sure you stated the requirement correctly. By definition, any file that exists in a directory has to be older than "now", even if it is still open for writing. But here is a way to find files older then a certain time/date - use
Code:
touch -t yyyymmmddhhmmss dummy find /path/to/files ! -newer dummy -type f |
|
||||
|
Whenever i run the code whatever file is in the specified directory should get renamed and moved to the specified folder provided the file created date and time is older than the current date and time.
Last edited by ragavhere; 11-20-2008 at 01:12 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|