Getting all the .gz files between Two Date/TimeStamps


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting all the .gz files between Two Date/TimeStamps
# 1  
Old 09-12-2008
Getting all the .gz files between Two Date/TimeStamps

Hi,

I am trying to write a script to ftp and get all the files between two date/time stamps from a archive directory. I have sent an attatchment of my archive directory. With the script I intend to get files for ex: between request.log.2008-08-22-03-53-49.gz & request.log.2008-09-12-01-21-02.gz.

I searched for similiar queries on the forum but the solutions there didnt work for me. Any suggestions and help is sincerely appreciated


Thanks for your time
# 2  
Old 09-12-2008
One quick way is to enter dates corresponding to $1, $2, $n and use that with a wildcard get. example:

./ftp.sh 2008-7 2008-8 2008-9

then inside you script:

ftp to where ever
get request.log.$1*
get request.log.$2*
get request.log.$n*

Also, I would used the logical && inside a if loop.
Code:
if [[ $list_of_files = $start_date && $list_of_files = $end_date ]]; then
       ftp my stuff
fi

I'm sure there is a more elegant solution but hope that gets you started.
# 3  
Old 09-15-2008
Thanks for the reply,

I tried using the method you suggested, but it didnt work on expected lines.
# 4  
Old 09-15-2008
Can you show the code that you used, and the results that you received?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to compare two files of todays date and yesterday's date

hi all, How to compare two files whether they are same are not...? like i had my input files as 20141201_file.txt and 20141130_file2.txt how to compare the above files based on date .. like todays file and yesterdays file...? (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies

2. Shell Programming and Scripting

Find matching timestamps in two files.

OK. if the first file is : 3184 2014-07-28 04:15 global.Remote-Access 10.111.8.25 81.245.6.25 tcp 3268 3035 2014-07-28 04:16 global.Remote-Access 10.111.8.12 81.245.6.25 tcp 3268If the second file is: 1 Jul 28 04:12 2014-07-28 id967254(BGC-TLW-Cert) Tunneling: User with IP... (8 Replies)
Discussion started by: fxsme
8 Replies

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

4. Shell Programming and Scripting

Issues with comparing 2 files timestamps

Hi, Im trying to write a script to first check a directory and if the filename has "ACK" in it do nothing and exit but if it has "ORD" in the filename then compare it with a dummy file created 2 minutes previous and see which one is newer Im getting a few errors which im unsure how to rectofy... (5 Replies)
Discussion started by: 02JayJay02
5 Replies

5. Shell Programming and Scripting

Sorting the files on their timestamps

Hi, The file names are like XXXX_20111101.gz for 01 November 2011, etc. There might be several files for 01 November 2011 and I can find them using find DIR -name *_20111101.gz -exec ls -lt {} \; But I want to sort the listing returned by the above command on the timestamps of the files... (6 Replies)
Discussion started by: sagarparadkar
6 Replies

6. Shell Programming and Scripting

Bash script to copy timestamps of multiple files

Hi, I have a bunch of media files in a directory that have been converted (from MTS to MOV format), so my directory contains something like this: clip1.mts clip1.mov clip2.mts clip2.mov The problem is that the .mov files that have been created have the timestamps of the conversion task,... (2 Replies)
Discussion started by: Krakus
2 Replies

7. Shell Programming and Scripting

Sorting Files by date and moving files in date order

I need to build a k shell script that will sort files in a directory where files appear like this "XXXX_2008021213.DAT. I need to sort by date in the filename and then move files by individual date to a working folder. concatenate the files in the working folder then start a process once... (2 Replies)
Discussion started by: rebel64
2 Replies

8. Shell Programming and Scripting

Concatenate all the files in folder on timestamps

Hi Gurus, Experts, I am facing a problem to concatenate all the files based on timeStamps. The Problem is like this . The are many files in a folder Which are of the below types Ack_to_MDS_20070809141159.xml Ack_to_MDS_20070809141157.xml Ack_to_MDS_20070809141155.xml... (19 Replies)
Discussion started by: srikanthgr1
19 Replies

9. Shell Programming and Scripting

Sort files by Date-timestamps available in filename & pick the sortedfiles one by one

Hi, I am new to Unix shell scripting. Can you please help me with this immediate requirement to code.. The requirement is as given below. In a directory say Y, I have files like this. PP_100000_28062006_122731_746.dat PP_100000_28062006_122731_745.dat PP_100000_28062006_122734_745.dat... (4 Replies)
Discussion started by: Chindhu
4 Replies

10. Shell Programming and Scripting

Subtracting date / timestamps

I have looked through the forums and found many date / time manipulation tools, but cannot seem to find something that fits my needs for the following. I have a log file with date time stamps like this: Jun 21 17:21:52 Jun 21 17:24:56 Jun 21 17:27:59 Jun 21 17:31:03 Jun 21 17:34:07 Jun... (0 Replies)
Discussion started by: roadcyclist
0 Replies
Login or Register to Ask a Question