View file on previous day

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting View file on previous day
# 1  
View file on previous day

Hi Expert,

I am new to UNIX , I am looking for a script which can show me list of file created on previous date within specified directory.

# 2  
# min=$(date +%M); currtime=$(($(date +%k)*60 + ${min#0*} )); find . -mmin -$((currtime + (24 * 60))) -a -mmin +$((${currtime} +
1)) | xargs ls -lrt

This User Gave Thanks to sathyaonnuix For This Post:
# 3  
Thanks Sathyaonnuix,but its not working for me. Could you please verify the same?
# 4  
Mackjack, can you please share your result screen.
# 5  
# sh
date: bad format character - k *60 + 40 : syntax error

Last edited by Scott; 01-03-2013 at 11:42 AM.. Reason: Code tags
# 6  
Can you please trying replacing k with H, also please provide the Unix you using.

you can do that by :
uname -a

# 7  
HP-UX KEPSBGNO B.11.31 U ia64 2041722302 unlimited-user license

the script is running with replacing k with H

But with one : bad option -mmin error

# sh
find: bad option -mmin
total 656
-rw-r--r--   1 root       sys             57 Aug  8 11:02 Multi-line.log
-rw-r--r--   1 root       sys            393 Aug 16 19:59 APPLMON06.bat
-rw-r--r--   1 root       sys             11 Aug 25 22:01 APPLMON06_Aug-26-2012_00:00:00.txt
-rwxrwxrwx   1 root       sys            323 Aug 25 22:39
-r--r-xr-x   1 root       sys             31 Aug 25 22:44 APPLMON06_Aug-25-2012_00:00:00.txt
-rw-r--r--   1 root       sys             11 Aug 28 03:39 APPLMON06_Aug-31-2012_00:00:00.txt
-rwxrwxrwx   1 root       sys            385 Aug 28 04:18

---------- Post updated at 09:13 AM ---------- Previous update was at 09:09 AM ----------

also not listing file on previous date only. listing all files

Last edited by Scott; 01-03-2013 at 11:42 AM.. Reason: Please use code tags
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #63
Difficulty: Easy
Blackberry was the first company to use the Emoji for mobile devices.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get Previous day error from alertlog

Hi All, I want to get the all ORA- related errors from attached logfile for previous day. Pls help. Thanks ! Regards Kamal (7 Replies)
Discussion started by: kamauv234
7 Replies

2. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

3. Shell Programming and Scripting

grep lines from the previous day's file

I have files called printfile.log.1121, printfile.log.1122, etc where 1121 and 1122 are the date of the file creation. The file contents are like: ================================================================================ User = d_prod Env = d_prod Dir =... (3 Replies)
Discussion started by: Daniel Gate
3 Replies

4. Shell Programming and Scripting

Script to check if last modified day is previous day

Hi, I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it. For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's... (1 Reply)
Discussion started by: hegdepras
1 Replies

5. Shell Programming and Scripting

finding the previous day date and creating a file with date

Hi guys, I had a scenario... 1. I had to get the previous days date in yyyymmdd format 2. i had to create a file with Date inthe format yyyymmdd.txt format both are different thanks guys in advance.. (4 Replies)
Discussion started by: apple2685
4 Replies

6. Shell Programming and Scripting

How to view files from a specific date/day

I wan to view files in a directory of a specific date. For example a log directory has log files . I want to view the list of the files which were generated on 01-May-2011. Is there any option/proces to perform it?? (1 Reply)
Discussion started by: mady135
1 Replies

7. Shell Programming and Scripting

getting previous day.

Hi, i am developing a script for my project. In my script i need to check some conditions based upon some values. in that one value is the previous date. with the previous date i need to check and process some values. I have a function with me retrieve the yesterdays date. But now i have a... (6 Replies)
Discussion started by: intiraju
6 Replies

8. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

9. Shell Programming and Scripting

Check File Exists and compare to previous day file script

We have data files that are ftp'd every morning to a SUN server. The file names are exactly the same except for that each has the date included in its name. I have to write script to do 2 things: STEP 1) Verify that the file arrived in morning. STEP 2) Compare the file size of the current... (3 Replies)
Discussion started by: rbknisely
3 Replies

10. Shell Programming and Scripting

next/Previous business day

Hello, Can you please help me how do i get previous and next working day of the week for a given date excluding saturday and sunday. Ex: if the given date is monday, i should get friday and tuesday's date if the given date is friday, i should get thrusday and monday's date. Thanks,... (4 Replies)
Discussion started by: kotasateesh
4 Replies

Featured Tech Videos