finding the files based on date..


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting finding the files based on date..
# 1  
Old 05-12-2011
Bug 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 had to send a mail to the user and have to copy the files to another location.

can u people give me the suggestion on this..

thanks in advance..Smilie
regards,
venkat
# 2  
Old 05-12-2011
Code:
>maillog;mydir=/home/pmutv/test/ ; backupdir=/home/pmutv/backup
find $mydir -name "product.sh.$(date +%Y%m%d)*"|while read -r myfile ; do [ -s $myfile ] && echo "$myfile --> exits and not empty" >>maillog
cp $file $backupdir ; done ; mail -s "Files in $mydir" xxxx@yyyyy.com <maillog

# 3  
Old 05-13-2011
Question

Hi,

Here in the above scenario there are 43 files with different names.

every day these 43 files are added the files no is constant for each day.

these files were suffixed by that days date as 20110513..

can i replace file name as *20110513 insted of product.sh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Finding all files based on pattern

Hi All, I need to find all files in a directory which are containing specific pattern. Thing is that file name should not consider if pattern is only in commented area. all contents which are under /* */ are commented all lines which are starting with -- or if -- is a part of some sentence... (13 Replies)
Discussion started by: Lakshman_Gupta
13 Replies

3. Shell Programming and Scripting

Finding files and sorting by date (find | awk)

I am wanting to search a directory tree and return files that are older than a specified datetime. So far straight forward with find, now I want to sort in date order and format the output. So far I have this, but is not working and there is a problem with "." in the file and/or path names. ... (2 Replies)
Discussion started by: larry2311
2 Replies

4. Shell Programming and Scripting

Finding/replacing strings in some files based on a file

Hi, We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Discussion started by: Talkabout
9 Replies

5. UNIX for Advanced & Expert Users

Finding/Grep on files with date and hour in the file name

Hi, I have a folder structure as follows, DATA -> 2012-01-01 -> 00 -> ABC_2012-01-03_00.txt -> 01 -> ABC_2012-01-03_01.txt -> 02 -> ABC_2012-01-03_02.txt ... -> 23 -> ABC_2012-01-03_02.txt -> 2012-01-02 ... (1 Reply)
Discussion started by: mihirvora16
1 Replies

6. Shell Programming and Scripting

Finding/Grep on files with date and hour in the file name

Hi, I have a folder structure as follows, DATA -> 2012-01-01 -> 00 -> ABC_2012-01-03_00.txt -> 01 -> ABC_2012-01-03_01.txt -> 02 -> ABC_2012-01-03_02.txt ... -> 23 -> ABC_2012-01-03_02.txt -> 2012-01-02 -> 2012-01-03 So the dir DATA contains the above hierarchy, User input Start and... (6 Replies)
Discussion started by: mihirvora16
6 Replies

7. Shell Programming and Scripting

Finding files before a certain date with predefined format

Guys, I have an input file such as below I would like to know how i would be able to find items created before 2011-10-01 Appreciate any expert advice. Thanks. (3 Replies)
Discussion started by: aismann
3 Replies

8. UNIX for Dummies Questions & Answers

finding and moving files based on the last three numerical characters in the filename

Hi, I have a series of files (upwards of 500) the filename format is as follows CC10-1234P1999.WGS84.p190, all in one directory. Now the last three numeric characters, in this case 999, can be anything from 001 to 999. I need to move some of them to a seperate directory, the ones I need to... (5 Replies)
Discussion started by: roche.j.mike
5 Replies

9. Shell Programming and Scripting

Finding files for a date

Hi, I have a directory with files from past 2 years.I need to find all the files for a specific date . Due to certain reasons I could not use this command in my process find . -type f \( -newer /tmp/May-1-2007 -a ! -newer... (4 Replies)
Discussion started by: Raamc
4 Replies

10. Shell Programming and Scripting

Finding files older than the current date and time and renaming and moving

Hi, I have a very urgent requirement here. I have to find all files in the specified directory but not in the sub directories(The directory name is stored in a variable) which are older than the current date as well as current time and rename it as filename_yyyymmddhhmmss.ext and move it into a... (7 Replies)
Discussion started by: ragavhere
7 Replies
Login or Register to Ask a Question