Sponsored Content
Top Forums Shell Programming and Scripting Get the newest files based on date Post 302338331 by Beginer0705 on Monday 27th of July 2009 03:15:23 PM
Old 07-27-2009
Get the newest files based on date

Hello friends,
I'm learning to script, and I need help.

How can I get the latest/newest files based on date? the format is as following:

Feb 07 19:25 TESTPWD_file_1vk6pn40_19519_1
Feb 07 19:46 TESTPWD_file_1uk6pn40_19518_2
Feb 07 19:47 TESTPWD_file_20k6pn40_19520_2
Feb 07 19:56 TESTPWD_file_23k6po9j_19523_1
Feb 07 19:56 Config_TESTPWD_020709:19:10.TXT

Jun 06 19:38 TESTPWD_10204_file_77kgu17l_19687_1
Jun 06 19:40 TESTPWD_10204_file_7akgu17p_19690_1
Jun 06 20:05 TESTPWD_10204_file_7dkgu3ba_19693_1
Jun 06 20:11 TESTPWD_10204_file_7ckgu344_19692_1
Jun 06 20:21 TESTPWD_10204_file_7ckgu344_19692_2
Jun 06 20:22 Config_TESTPWD_10204_060609:19:10.TXT

Jul 27 19:38 TESTPWD_10204_file_77kgu17l_19687_1
Jul 27 19:40 TESTPWD_10204_file_7akgu17p_19690_1
Jul 27 19:59 TESTPWD_10204_file_79kgu17l_19689_2
Jul 27 20:05 TESTPWD_10204_file_7dkgu3ba_19693_1
Jul 27 20:11 TESTPWD_10204_file_7ckgu344_19692_1
Jul 27 20:22 Config_TESTPWD_10204_060609:19:10.TXT

Thanks for your help.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove files based on date

I am trying to write a shell script that will remove files in a directory based on the date. For instance, remove all files older than yesterday. Any ideas? (4 Replies)
Discussion started by: hshapiro
4 Replies

2. Shell Programming and Scripting

Count of files based on date?

Hi Friends, Can anyone help me with this: To get the count of files that are existing in a directory created on a perticular date like in the example (01/08) .(having same pattern for the filename) ex: FileName Creted Date FILE001 01/08/2007 FILE005 ... (6 Replies)
Discussion started by: sbasetty
6 Replies

3. Shell Programming and Scripting

Copy files based on date

Hi all i am having so many files in my directory.Is there any option to copy files based on date. example i am having file this -rw-rw-r-- 1 ram user 1 Feb 2 17:12 abc -rw-rw-r-- 1 ram user 1 Feb 2 17:12 bnw -rwxrwxr-x 1 ram user 21122 Feb 4... (3 Replies)
Discussion started by: suryanarayana
3 Replies

4. Shell Programming and Scripting

Deleting the files based on the date's

I have to write one script which will delete the files in the below passion. If today is 17-Feb-2010 then the script delete only 17-JAN-2010 files from the directory. Could you please help me, How will I delete the files when the year is leap year, if today is 30th Mar 2010 then how will... (1 Reply)
Discussion started by: kandi.reddy
1 Replies

5. UNIX for Dummies Questions & Answers

Remove files based on date

Hello team, I have a number of files in a folder which are dated yesterday and today.Can i remove all the files which i created today based on date?? is there any syntax for this ?? (1 Reply)
Discussion started by: kanakaraju
1 Replies

6. Shell Programming and Scripting

finding the files based on date..

Hi to every one , i had ascenario like this.. i had path like export/home/pmutv/test/ in this i will recive 43 files daily with each file having that days date i.e like product.sh.20110512 like this i will 43 files every day i had to find the files. if files are avaliable i... (2 Replies)
Discussion started by: apple2685
2 Replies

7. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

8. Shell Programming and Scripting

Find file by filename or with newest modified date

Hi, I have a directory that has numerous files in it, and there is two which are named "filerec_ddmmyyHH24MMSS" by the time they are created so "filerec_010615012250" was created at 01:22:50 on 1st June 2015. I need to find the most recently created of those 2 files and get the contents of... (4 Replies)
Discussion started by: finn
4 Replies

9. Shell Programming and Scripting

Delete all but 3 newest files

This is related to my post on backup up files. I really appreciate all the help too. :-) I would like to delete all but the 3 newest files in my backup directory. /media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/ For example Ubuntu_Documents.zip_09Aug2018_12_00... (2 Replies)
Discussion started by: drew77
2 Replies

10. UNIX for Beginners Questions & Answers

Find the files based on date from filelist

Hi All, I have a filelist which contains the "ls" output, i want to extract the filenames written in this files based on date. I know i can run loop and extract the file but i want to avoid it. also there is find command which can be used on directory i.e. find . -type f -newermt "2019-09-25"... (3 Replies)
Discussion started by: kumarinfa
3 Replies
rdate(1M)                                                 System Administration Commands                                                 rdate(1M)

NAME
rdate - set system date from a remote host SYNOPSIS
rdate hostname DESCRIPTION
rdate sets the local date and time from the hostname given as an argument. You must have the authorization solaris.system.date on the local system. Typically, rdate is used in a startup script. The inetd daemon responds to rdate requests. To enable inetd response, the lines invoking the time command in inetd.conf must not be com- mented out. USAGE
The rdate command is IPv6-enabled. See ip6(7P). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWrcmdc | +-----------------------------+-----------------------------+ SEE ALSO
inetd(1M), inetd.conf(4), attributes(5), ip6(7P) SunOS 5.10 15 Feb 2001 rdate(1M)
All times are GMT -4. The time now is 07:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy