Sponsored Content
Top Forums Shell Programming and Scripting To get the files in a directory for the given date (User entered date) Post 302861835 by ramprabhum on Wednesday 9th of October 2013 04:39:58 PM
Old 10-09-2013
Lightbulb To get the files in a directory for the given date (User entered date)

Need a ksh script to get the files that were created or modified in a directory on a particular date entered by the user.

For example if a directory contains files as below :

Code:
> ll
total 41
-rw-rw-r--    1 psn      psn           199 Aug 23 07:06 psn_roll.sh
-rw-rw-r--    1 psn      psn           451 Aug 24 09:24 x.log
-rw-rw-r--    1 psn      psn           451 Aug 23 05:27 y.log
-rwxrwxr-x    1 psn      psn           451 Aug 24 09:29 z.log
-rw-rw-r--    1 psn      psn           233 Aug 23 09:28 Items1.txt
-rw-rw-r--    1 psn      psn           233 Aug 24 12:00 Items2.txt
drwxrwxr-x    2 psn      psn          2119 Aug 23 08:44 final
-rwxrwxr-x    1 psn      psn             6 Aug 25 08:36 sample.sh
-rw-rw-r--    1 psn      psn            85 Aug 23 06:17 best.log

When a user enters a date 2013/08/23

I have to get the files that were created or modified on that date.

Desired output:

Code:
Enther the date: 2013/08/23

psn_roll.sh
y.log
Items1.txt
best.log

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Creating date directory and moving files into that directory

I have list of files named file_username_051208_025233.log. Here 051208 is the date and 025233 is the time.I have to run thousands of files daily.I want to put all the files depending on the date of running into a date directory.Suppose if we run files today they should put into 05:Dec:08... (3 Replies)
Discussion started by: ravi030
3 Replies

2. Shell Programming and Scripting

validating user entered date

I need the date validation. I searched in the google but i didn't find my requirements. requirements: 1) user has to enter the date in YYYY/MM/DD format 2) MM validations 3) DD validations. and if the month is april it should allow 30 days only and for May month it should allow 31 days like... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

3. Shell Programming and Scripting

How to increment a user defined date value in the DATE format itself using shell script?

I need to increment a date value through shell script. Input value consist of start date and end date in DATE format of unix. For eg. I need increment a date value of 1/1/09 to 31/12/09 i.e for a whole yr. The output must look like 1/1/09 2/2/09 . . . 31/1/09 . . 1/2/09 . 28/2/09... (1 Reply)
Discussion started by: sunil087
1 Replies

4. Shell Programming and Scripting

Number of days between the current date and user defined date

I am trying to find out the number of days between the current date and user defined date. I took reference from here for the date2jd() function. Modified the function according to my requirement. But its not working properly. Original code from here is working fine. #!/bin/sh... (1 Reply)
Discussion started by: hiten.r.chauhan
1 Replies

5. Shell Programming and Scripting

find files for next day of the date entered

i have few files generated everyday with a date stamp. Sometimes it happens that if the files are generated late i.e after 00:00 hrs the date stamp will be of the next day. example: 110123_file1 110123_file2 110123_file3 110124_file4 in the above example file4 is also for the previous... (2 Replies)
Discussion started by: gpk_newbie
2 Replies

6. UNIX for Dummies Questions & Answers

Rename all Files in a UNIX Directory from one date format to another date format

Hi Unix Gurus, I would like to rename several files in a Unix Directory . The filenames can have more than 1 underscore ( _ ) and the last underscore is always followed by a date in the format mmddyyyy. The Extension of the files can be .txt or .pdf or .xls etc and is case insensitive ie... (1 Reply)
Discussion started by: pchegoor
1 Replies

7. AIX

Need to get the next day's date of the user entered date

I need to get the next day's date of the user entered date for example: Enter date (yyyy/mm/yy): 2013/10/08I need to get the next day's date of the user entered date Desired Output: 2013/10/09Though there are ways to achieve this is Linux or Unix environment (date command) ,I need to... (1 Reply)
Discussion started by: rpm120
1 Replies

8. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

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... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

9. Shell Programming and Scripting

Detect DST from a date entered by user in bash

I am trying to write a bash script that takes in a users input of a specific date in a format such as MM/DD/YYYY and returns whether or not that specific date was during daylight savings time or not. Is there a specific function that checks this? Does the date command have a way to do this? I am... (1 Reply)
Discussion started by: conman1985
1 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
Processes(3)						User Contributed Perl Documentation					      Processes(3)

NAME
Mac::Processes - Macintosh Toolbox Interface to Process Manager SYNOPSIS
use Mac::Processes; while ( ($psn, $psi) = each(%Process) ) { print "$psn ", $psi->processName, " ", $psi->processNumber, " ", $psi->processType, " ", $psi->processSignature, " ", $psi->processSize, " ", $psi->processMode, " ", $psi->processLocation, " ", $psi->processLauncher, " ", $psi->processLaunchDate, " ", $psi->processActiveTime, " ", $psi->processAppSpec, " "; } DESCRIPTION
Access to Inside Macintosh is essential for proper use of these functions. Explanations of terms, processes and procedures are provided there. Any attempt to use these functions without guidance can cause severe errors in your machine, including corruption of data. You have been warned. Constants kNoProcess kSystemProcess kCurrentProcess Special process IDs. launchContinue launchNoFileFlags launchUseMinimum launchDontSwitch launchAllow24Bit launchInhibitDaemon Launch flags. modeDeskAccessory modeMultiLaunch modeNeedSuspendResume modeCanBackground modeDoesActivateOnFGSwitch modeOnlyBackground modeGetFrontClicks modeGetAppDiedMsg mode32BitCompatible modeHighLevelEventAware modeLocalAndRemoteHLEvents modeStationeryAware modeUseTextEditServices modeDisplayManagerAware Mode flags in SIZE resource. LaunchParam This Perl hash maps onto the fields of a Launch Parameter Block. The fields are: launchFileFlags launchControlFlags launchAppSpec launchAvailableSize launchProcessSN launchPreferredSize launchMinimumSize new LaunchParam [ARGUMENTS] Returns LaunchParam. $launch = new LaunchParam(launchAppSpec =E<gt> "hd:apps:myapp", launchMinimumSize => 32000); DESTROY LPB ProcessInfo This Perl hash allows access to the "ProcessInfo" structure. The field names are: processName processNumber processType processSignature processSize processMode processLocation processLauncher processLaunchDate processActiveTime processAppSpec DESTROY PI Functions LaunchApplication LAUNCHPARAMS The LaunchApplication function launches the application from the specified file and returns the process serial number if the application is successfully launched. Returns undef on failure. LaunchDeskAccessory PFILESPEC, PDANAME Mac OS only. The LaunchDeskAccessory function searches the resource fork of the file specified by the pFileSpec parameter for the desk accessory with the 'DRVR' resource name specified in the pDAName parameter. If the 'DRVR' resource name is found, LaunchDeskAccessory launches the corresponding desk accessory. If the desk accessory is already open, it is brought to the front. Returns zero on failure. GetCurrentProcess The GetCurrentProcess function returns the process serial number of the process that is currently running, that is, the one currently accessing the CPU. Return "undef" if an error was detected. GetFrontProcess The GetFrontProcess function returns the process serial number of the process running in the foreground. Return "undef" if an error was detected. GetNextProcess PSN Get information about the next process, if any, in the Process ManagerO~s internal list of open processes. Return "undef" if an error was detected. GetProcessInformation PSN The GetProcessInformation function returns, in a process information record, information about the specified process. The information returned in the info parameter includes the applicationO~s name as it appears in the Application menu, the type and signature of the application, the address of the application partition, the number of bytes in the application partition, the number of free bytes in the application heap, the application that launched the application, the time at which the application was launched, and the location of the application file. Return "undef" if an error was detected. SetFrontProcess PSN The SetFrontProcess function schedules the specified process to move to the foreground. The specified process moves to the foreground after the current foreground process makes a subsequent call to WaitNextEvent or EventAvail. Returns zero on failure. WakeUpProcess PSN The WakeUpProcess function makes a process suspended by WaitNextEvent() eligible to receive CPU time. A process is suspended when the value of the sleep parameter in the WaitNextEvent() function is not 0 and no events for that process are pending in the event queue. This process remains suspended until the time specified in the sleep parameter expires or an event becomes available for that process. You can use WakeUpProcess to make the process eligible for execution before the time specified in the sleep parameter expires. Returns zero on failure. SameProcess PSN1, PSN2 The SameProcess function compares two process serial numbers and determines whether they refer to the same process. Return "undef" if an error was detected. ExitToShell This function is not implemented: ExitToShell() unsupported. Use exit. GetProcessPID(PSN) Mac OS X only. Get the UNIX process ID corresponding to a process serial number. GetProcessForPID(PID) Mac OS X only. Get the process serial number corresponding to a UNIX process ID. LSFindApplicationForInfo(creator, bundleID=NULL, name=NULL) Mac OS X only. Return the path to the application matching one or more of creator, bundleID, and name. Pass undef or empty string for unused parameters. $path = LSFindApplicationForInfo("R*ch"); $path = LSFindApplicationForInfo(undef, "com.barebones.bbedit"); $path = LSFindApplicationForInfo(undef, undef, "BBEdit.app"); $path = LSFindApplicationForInfo("R*ch", "com.barebones.bbedit", "BBEdit.app"); AUTHOR
Written by Matthias Ulrich Neeracher <neeracher@mac.com>, documentation by Bob Dalgleish <bob.dalgleish@sasknet.sk.ca>. Currently maintained by Chris Nandor <pudge@pobox.com>. perl v5.16.2 2013-08-25 Processes(3)
All times are GMT -4. The time now is 12:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy