Files and dates


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Files and dates
Prev   Next
# 1  
Old 12-03-2007
Files and dates

Hello all. I am trying to do a file listing on a particular directory by date. I need to list the files and their directories that have a timestamp between Dec-1-2006 and Jan-1-2007. Any help would be greatly appreciated.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need to Move files of different dates

Hi, Currently I'm moving the files based on date like below. "mv *20150901* backup_folder" - Limitation: can move only 1 day files to backup folder. I want to move the files of different dates like 20150901,02, 03, 04..... Is there any single command to do it. Thanks in advance!! (2 Replies)
Discussion started by: prakashs1218
2 Replies

2. Shell Programming and Scripting

Moving files into dirs corresponding to dates

I am trying to find a way to move files into corresponding date files. i=0 while read line do array="$line" (( i++ )) done < <(ls) cd $(echo ${array}) echo ${array}} pwd #cd "$(array}" ] || mkdir 2015 cd "2015" ] || mkdir 02-February ] || mkdir 03-March ] || mkdir... (10 Replies)
Discussion started by: newbie2010
10 Replies

3. Shell Programming and Scripting

Deleting the files between particular dates

Hi Please help me for the below task. In my home directory if I run ls -l command, it lists all the files, here I want to delete files created from January 2014 to Aug 2014...but I need to keep the files which are created after September 01 2014. Thanks Siva (3 Replies)
Discussion started by: kumar85shiv
3 Replies

4. Shell Programming and Scripting

Files between two dates in UNIX

Hi Team, I need to connect to a prod server and need to get the files which falls between two dates. I should not create ant files on that machine. I am using korn shell. Your help is very much appreciated. Vinay (13 Replies)
Discussion started by: gvkumar25
13 Replies

5. UNIX for Advanced & Expert Users

Find all files other than first two files dates & last file date for month

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (16 Replies)
Discussion started by: Makarand Dodmis
16 Replies

6. AIX

Copy files for particular dates

Hi, I need to copy particular date files from one directory to another. For example, I have thousands of files in /home/usr From this I need to copy only particular date files (each date contains thousand number of files) to some directory of another server. Could anyone please help me... (3 Replies)
Discussion started by: teddy2882
3 Replies

7. Shell Programming and Scripting

Need script to generate all the dates in DDMMYY format between 2 dates

Hello friends, I am looking for a script or method that can display all the dates between any 2 given dates. Input: Date 1 290109 Date 2 010209 Output: 300109 310109 Please help me. Thanks. :):confused: (2 Replies)
Discussion started by: frozensmilz
2 Replies

8. Shell Programming and Scripting

Getting list of all the log files between two dates

I need to get the list of all the log files for a particular duration, say between two dates,i.e I need to get the list of all the log files between date1 and date2.The two dates are entered by the user. The format of the log file is : /path_name/graph_name_20080801180308.log. I dont... (1 Reply)
Discussion started by: avishekp
1 Replies

9. UNIX for Dummies Questions & Answers

files between any two given dates

Can any one help me in getting all the files between any two given dates.. (8 Replies)
Discussion started by: thanuman
8 Replies

10. UNIX for Dummies Questions & Answers

Remove files by dates

I've tried every way possible to remove files by date and nothing seems to work. Does anyone have an idea how to remove files by dates? Thanks in advance.... (1 Reply)
Discussion started by: dman110168
1 Replies
Login or Register to Ask a Question
STRTOTIME(3)								 1							      STRTOTIME(3)

strtotime - Parse about any English textual datetime description into a Unix timestamp

SYNOPSIS
int strtotime (string $time, [int $now = time()]) DESCRIPTION
The function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given in $now, or the current time if $now is not supplied. Each parameter of this function uses the default time zone unless a time zone is specified in that parameter. Be careful not to use dif- ferent time zones in each parameter unless that is intended. See date_default_timezone_get(3) on the various ways to define the default time zone. PARAMETERS
o $time -A date/time string. Valid formats are explained in Date and Time Formats. o $now - The timestamp which is used as a base for the calculation of relative dates. RETURN VALUES
Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure. ERRORS
/EXCEPTIONS Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT or E_WARNING message if using the system settings or the $TZ environment variable. See also date_default_timezone_set(3) CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Prior to PHP 5.3.0, relative time formats sup- | | | plied to the $time argument of strtotime(3) such | | | as this week, previous week, last week, and next | | | week were interpreted to mean a 7 day period rel- | | | ative to the current date/time, rather than a | | | week period of Monday through Sunday. | | | | | 5.3.0 | | | | | | | Prior to PHP 5.3.0, 24:00 was not a valid format | | | and strtotime(3) returned FALSE. | | | | | 5.2.7 | | | | | | | In PHP 5 prior to 5.2.7, requesting a given | | | occurrence of a given weekday in a month where | | | that weekday was the first day of the month would | | | incorrectly add one week to the returned time- | | | stamp. This has been corrected in 5.2.7 and later | | | versions. | | | | | 5.1.0 | | | | | | | Now returns FALSE on failure, instead of -1. | | | | | 5.1.0 | | | | | | | Now issues the E_STRICT and E_NOTICE time zone | | | errors. | | | | | 5.0.2 | | | | | | | In PHP 5 up to 5.0.2, "now" and other relative | | | times are wrongly computed from today's midnight. | | | This differs from other versions where it is cor- | | | rectly computed from current time. | | | | | 5.0.0 | | | | | | | Microseconds began to be allowed, but they are | | | ignored. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A strtotime(3) example <?php echo strtotime("now"), " "; echo strtotime("10 September 2000"), " "; echo strtotime("+1 day"), " "; echo strtotime("+1 week"), " "; echo strtotime("+1 week 2 days 4 hours 2 seconds"), " "; echo strtotime("next Thursday"), " "; echo strtotime("last Monday"), " "; ?> Example #2 Checking for failure <?php $str = 'Not Good'; // previous to PHP 5.1.0 you would compare with -1, instead of false if (($timestamp = strtotime($str)) === false) { echo "The string ($str) is bogus"; } else { echo "$str == " . date('l dS of F Y h:i:s A', $timestamp); } ?> NOTES
Note If the number of the year is specified in a two digit format, the values between 00-69 are mapped to 2000-2069 and 70-99 to 1970-1999. See the notes below for possible differences on 32bit systems (possible dates might end on 2038-01-19 03:14:07). Note The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.) Prior to PHP 5.1.0, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems. For 64-bit versions of PHP, the valid range of a timestamp is effectively infinite, as 64 bits can represent approximately 293 bil- lion years in either direction. Note Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash ( /), then the American m/d/y is assumed; whereas if the separator is a dash ( -) or a dot ( .), then the European d-m-y format is assumed. To avoid potential ambiguity, it's best to use ISO 8601 ( YYYY-MM-DD) dates or DateTime::createFromFormat when possible. Note Using this function for mathematical operations is not advisable. It is better to use DateTime::add and DateTime::sub in PHP 5.3 and later, or DateTime::modify in PHP 5.2. SEE ALSO
Date and Time Formats, DateTime::createFromFormat, checkdate(3), strptime(3). PHP Documentation Group STRTOTIME(3)