Sponsored Content
Top Forums Shell Programming and Scripting How to find files created today in a particular directory? Post 302663593 by methyl on Thursday 28th of June 2012 09:25:41 AM
Old 06-28-2012
Further to @jayan_jay, it would be better to match on the Month and Day, though I think I now see what your RE is doing. In most versions of date, the day field is available in various formats - including with a leading space character for single digit days:

Code:
TODAY="`date '+%b %e'`"        # Mmm dD
find dir_path -type f -mtime 0 -exec ls -lad {} \; | grep "${TODAY}"

My earlier post with find -newer is the most efficient.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find all files created by a specified user in a directory and its subdirectories

Is there a command or shell script which can be used for Finding all files created by a specified userid in a directory and its subdirectories. Say, I want to find all such files in directory /abc as well as in all the subdirectories such as /abc/xyz or /abc/xyz/pqr aqnd so on which was created... (5 Replies)
Discussion started by: abhilashnair
5 Replies

2. UNIX for Dummies Questions & Answers

To list all the files created today with directory path

Hi, Can any one tell the command to list all the files that are created as of today from all the directories? The Command "ls -ltR" is listing all the files. But I want the list of files that has been created as of today along with the directory path:) Thank you in advance.:) Regards,... (4 Replies)
Discussion started by: meetusha.b
4 Replies

3. Shell Programming and Scripting

Files with 0 file size and created today

hi, I am building a script to identify those files created/modified today and with file size 0. I am able to find the files with 0 file size and created/modified in last 24 hrs as shown below but not today (current date), I tried using (touch -t time filenm) but in my version of unix at work it... (7 Replies)
Discussion started by: rushs682
7 Replies

4. Shell Programming and Scripting

Calculate Files Created Today

I need to figure out how to get all the files from a certian dir ./123/*sat files and ./230/*sat files and several other directories which have these *sat files in them. I need to calculate how many were created today and how many yesterday from 2:00 pm on the 28th to 2pm on the 29th. It's a... (1 Reply)
Discussion started by: xgringo
1 Replies

5. Shell Programming and Scripting

Find the directory modified/created before 4 days

Hi, I have an application which creates some directories while running. I want to delete these directories which are 4 days older. i tried find . type d -mtime +1 -print And it is working fine.. but find . type d -mtime +4 -print is not giving any results which are 4 days... (6 Replies)
Discussion started by: Tuxidow
6 Replies

6. Shell Programming and Scripting

ftp - How to download files which created today?

Hello experts, I have written following script to download files which created today. Unfortunately, it's not working. test.ksh: #Defining variables USR='xxx' PASSWD='yyyy' HT='test.test.com' FILE='S*.pdf' XFILE=$(echo find . -type f -mtime 0) ZFILE=$(echo ls -tR|grep 'Jun 8')... (14 Replies)
Discussion started by: dipeshvshah
14 Replies

7. Shell Programming and Scripting

How to find the newly created directory

Hi, I need to create new directory by increasing the number by 1 of extracted lastly created directory. e.g. Log\out_log_1\ Log\out_log_2\ Log\out_log_3\ become Log\out_log_1\ Log\out_log_2\ Log\out_log_3\ Log\out_log_4\ Can anyone help how to do it in c-shell... (3 Replies)
Discussion started by: Andre_2008
3 Replies

8. AIX

How to find the date on which a particular directory is created?

how to find the date on which a particular directory is created? Thanks. (4 Replies)
Discussion started by: samsungsamsung
4 Replies

9. Linux

List all files created today exclude last one

Hi, ALL thanks in advance, i listed all files using this command ls -ltr $(date +%Y%m%d)*.xmlbut i would like to exclude the last one created ; Best regard MEROUAN Use code tags, thanks. (4 Replies)
Discussion started by: merouan
4 Replies

10. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies
date(1) 						      General Commands Manual							   date(1)

NAME
date - display or set the date and time SYNOPSIS
[mmddhhmm[[cc]yy]] sssfff]] DESCRIPTION
The command displays or sets the current HP-UX system clock date and time. Since the HP-UX system operates in Coordinated Universal Time (UTC), automatically converts to and from local standard or daylight/summer time, based on your environment variable. See in below. Options recognizes the following option: Input and output values in Coordinated Universal Time (UTC), functionally equivalent to Greenwich Mean Time (GMT), instead of in local time. Slowly adjust the time by seconds (fff represents fractions of a second). This adjustment can be positive or negative. The system's clock will be sped up or slowed down until it has drifted by the number of seconds specified. Formats The command has two forms for displaying the date and time and one form for setting them. Display the current date and time. The output is the same as for the formatting directive for all languages except the default language. See and below. Display the current date and time according to formatting directives specified in format, which is a string of zero or more formatting directives and ordinary characters. If it contains blanks, enclose it in apostrophes or quotation marks. See below. All ordinary characters are copied unchanged into the output string. The output string is always terminated with a newline character. If is specified and format is omitted, only a newline is output. Set the HP-UX system clock to the date and time specified. You require the superuser privilege. If you include the option, the specified date and time is assumed to be in Coordinated Universal Time (UTC). The numeric argument is interpreted left to right in two-digit pairs as follows: mm Month number dd Day number in the month hh Hour number (24-hour system) mm Minute number cc Century minus one yy Last two digits of the year number If omitted, the current year is used. If you attempt to set the date backwards, generates the warning, Type or the equivalent for your locale to set the clock backwards; anything else to cancel the command. When is used to set the date, a pair of date change records is written to the file (UNIX Standard only, see standards(5).) No warning is generated if date is set backwards. Formatting Directives The following formatting directives, shown without the optional field width and precision specification, are replaced by the indicated characters. If a directive is not one of the following, the result is undefined. The output for digits, characters, and words depends on the language/locale settings. See in below. The examples assume that the command was executed on Wednesday, January 12, 1994 at 7:45:58 p.m. Pacific Standard Time, using the default language. Abbreviated weekday name. For example, Full weekday name. For example, Abbreviated month name. For example, Full month name. For example, Current date and time representation. For example, Century (the year divided by 100 and truncated to an integer) as a two-digit decimal number For example, Day of the month as a two-digit decimal number For example, Day of the month as a two-character decimal number with leading space fill [ ]. For example, Combined Emperor/Era name and year. Hour (24-hour clock) as a two-digit decimal number For example, Hour (12-hour clock) as a two-digit decimal number For example, Day of the year as a three-digit decimal number For example, Month as a decimal two-digit number For example, Minute as a decimal two-digit number For example, Newline character. Emperor/Era name. Emperor/Era year. Equivalent of either AM or PM. For example, Time as %H:%M Second as a two-digit decimal number (allows for possible leap seconds) For example, Tab character. Weekday as a one-digit decimal number For example, Week number of the year (Sunday as the first day of the week) as a two-digit decimal number All days that precede the first Sunday in the year are considered to be in week For example, Week number of the year (Monday as the first day of the week) as a two-digit decimal number If the week containing January 1 has four or more days in the new year (January 1 is Thursday or sooner), it is designated as week otherwise, (January 1 is Friday or later), it is designated as the last week of the previous year, and the next week is week For example, Weekday as a one-digit decimal number For example, Week number of the year (Monday as the first day of the week) as a two-digit decimal number All days that precede the first Monday in the year are considered to be in week For example, Current date representation. For example, Current time representation. For example, Year without century as a two-digit decimal number For example, Year with century as a four-digit decimal number For example, Time zone name (or no characters if time zone cannot be determined). For example, The character. Obsolescent Directives The following directives are provided for backward compatibility. It is recommended that the preceding directives be used instead. Date in usual U.S. format. For example, Use or instead. Full month name. For example, Use instead. Abbreviated month name. For example, Use instead. Time in 12-hour U.S. format. For example, Use instead. Time in 24-hour U.S. format. For example, Use or instead. Time zone name (or no characters if time zone cannot be determined). For example, Use instead. Modified Formatting Directives Some Formatting Directives can be modified by the and modifier characters to indicate a different format or specification for the language specified in the environment variable. If the corresponding keyword and is not specified or not supported, the unmodified field descriptor value is used. The command displays the keywords and their values in the specified language (see locale(1)). Alternate appropriate date and time representation. The name of the base year in alternate representation. Alternate date representation. Offset from (year only) in the alternate representation. Full alternate year representation. Day of month using the alternate numeric symbols. Day of month using the alternate numeric symbols with leading space-character fill if applicable. Hour (24-hour clock) using the alternate numeric symbols. Hour (12-hour clock) using the alternate numeric symbols. Month using the alternate numeric symbols. Minutes using the alternate numeric symbols. Seconds using the alternate numeric symbols. Week number of the year (Sunday is the first day of the week) using the alternate numeric symbols. Weekday as number using the alternate numeric symbols Weekday number of the year (Monday is the first day of the week) using the alternate numeric symbols. Year (offset from in alternate representation. Field Width and Precision An optional field width and precision specification can immediately follow the initial of a formatting directive in the following order: The decimal digit string width specifies a minimum field width in which the result of the conversion is right- or left-justified. The default is right-justified with space padding on the left. If the string starts with "", the result is left-justified with space padding on the right. If the string starts with "", the result is right-justified and padded with zeros on the left. The decimal digit string prec specifies the minimum number of digits to appear for the and numeric directives. If a directive supplies fewer digits than specified by the precision, it will be expanded with leading zeros. prec specifies the maximum number of characters to be used from the and text directives. If a directive supplies more characters than specified by the precision, excess characters are truncated on the right. If no field width or precision is specified for a or directive, the default is for the directive, the default is for the default is for the default is EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5). Environment Variables determines the interpretation of the bytes within the format string as single- and/or multi-byte characters. determines the characters used to form numbers for those directives that produce numbers in the output. The characters used are those defined by (see locale(1) and in langinfo(5)). determines the content (for example, the weekday names produced by the directive) and format (for example, the current time representation produced by the directive) of date and time strings output by the command. determines the language in which messages (other than the date and time strings) are displayed. If or is not specified or is null, it defaults to the value of If is not specified or is null, it defaults to (see lang(5)). If any internationalization variable contains an invalid setting, all internationalization variables default to (see environ(5)). determines the conversion between the system time in UTC and the time in the user's local time zone. See environ(5) and tztab(4). also determines the content (that is, the time-zone name produced by the and directives) of date and time strings output by the command. If is not set or is set to the empty string, its default value is If the or the value cannot be read from the time zone adjustment table then returns the time in International Code Set Support Single and multibyte character code sets are supported. DIAGNOSTICS
The following messages may be displayed. The date/time specification is syntactically incorrect. Check it against the usage and for the correct range of each of the digit-pairs. The character c is not a valid format directive, field width specifier, or precision specifier. The date/time you specified is earlier than the current clock value. Type (or the equivalent for your locale) to set the clock backwards; anything else to cancel the command. You need the superuser privilege to change the date. EXAMPLES
Date in Different Languages Display the date. In this example, the environment variable contains and the language environment variables are set as noted. Set Date Set the date to Oct 8, 12:45 a.m. Display Formatted Date Display the current date and time using a format. Note the use of quotation marks due to the blanks in the format. The output resembles the following: Display Formatted Date Using Local Language Conversion With the date as set in the "Set Date" example above and set to (German): generates output similar to: where the month field is four characters long, flush-left, and space-padded on the right if the month name is shorter than four characters. The day field is two characters long, with leading zeros suppressed. WARNINGS
The former HP-UX format directive has been changed to for ANSI compatibility. Changing the date while the system is running in multiuser mode should be avoided to prevent disrupting user-scheduled and time sensitive programs and processes. Also, changing the date can cause and the SCCS and subsystems to behave in an unexpected manner. The daemon should be killed prior to setting the date backwards, then restarted. SCCS files should be checked with the command (see val(1)) if deltas have been made while the clock was wrongly set. The following formatting directives may be deleted from future releases: Currently, the maximum date supported is December 31, 2037 23:59:00 UTC. AUTHOR
was developed by AT&T and HP. FILES
SEE ALSO
locale(1), stime(2), ctime(3C), strftime(3C), tztab(4), environ(5), lang(5), langinfo(5), standards(5). STANDARDS CONFORMANCE
date(1)
All times are GMT -4. The time now is 12:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy