How to Zip the files from date Stamp to end date Stamp


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to Zip the files from date Stamp to end date Stamp
# 1  
Old 12-08-2006
How to Zip the files from date Stamp to end date Stamp

Hi,
I need to zip the list of files using from date Stamp to end date Stamp, How can I filter and make FromDate_EndDate.gzip?
any idea?
# 2  
Old 12-08-2006
gzip can only compress a single file. For a range of files (that is, an archive) you will require InfoZIP or an intermediate program to generate an archive file which can then be compressed using gzip.

With a little effort, you can use the find(1) command to generate a list of files for the desired date range.

For example, to find file that were modified between three and four weeks ago,

# find . -type f -mtime -29 -mtime +21

Or, find all files that were modified less than 29 days ago and more than 21 days ago. Try a few experiments to make certain you have the desired date range.

Either pipe it directly into zip(1),

# find . -type f -mtime -29 -mtime +21 | zip -@ 061110_061201.zip

or use the output as the file list for tar(1) and then pit into gzip:

# tar cvf - `find . -type f -mtime -29 -mtime +21` | gzip -c 1>061110_061201.tgz

To extract the gzip'd tarball,

# gunzip -c 061110_061201.tgz | tar xvf -
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want it to read the file name and then append date stamp at the end of file?

I was thinking something like for i in `find . -name "*.log.Z"`; do mv $i name.log.Z or something like that? (3 Replies)
Discussion started by: xgringo
3 Replies

2. Shell Programming and Scripting

Files with date and time stamp

Hi Folks, Need a clarification on files with date and time stamp. Here is my requirement. There is a file created everyday with the following format "file.txt.YYYYMMDDHHMMSS". Now i need to check for this file and if it is available then i need to do some task to the file. I tried... (6 Replies)
Discussion started by: jayadanabalan
6 Replies

3. Emergency UNIX and Linux Support

Is there any way to set the files modified date and stamp to last modifies time?

Actually i did modification in a file on server by mistake, now its showing current time stamp, is there any way to set the files modified date and stamp to last modifies time. Please advice here.Thanks in advance.:b: (7 Replies)
Discussion started by: saluja.deepak
7 Replies

4. Shell Programming and Scripting

How to check all files in dir has same date stamp?

Hello Experts, Can some one write the code to find, all files in the directory has today's time stamp or not? Dir = /doc Files ----- a.txt Aug 13 10:15 b.txt Aug 13 10:16 c.txt Aug 13 10:17 d.txt Aug 13 10:18 e.txt Aug 13 10:17 Thanks in advance Dip (2 Replies)
Discussion started by: dipeshvshah
2 Replies

5. Linux

rename files in a folder with date&time stamp

Hi, I want to rename all the files (more than 100 files) in a fodler to another folder with date&time stamp. foe eg, file1.dat file2.dat file3.dat .. to be renamed as file1100629_16_30_15.txt (yy-mon-dd_hh_mi_ss) file1100629_16_30_16.txt .. so on (2 Replies)
Discussion started by: feroz
2 Replies

6. Shell Programming and Scripting

PERL - Selecting specific files based on 'date stamp' values

Hi, I've list of files in a directory, which have date stamp value in their names. ex: abc_data_20071102.csv, abc_data_20091221.csv, abc_data_20100110.csv, abc_data_20100222.csv, abc_data_20080620.csv,... etc., I need to select and process only files, within the given date... (4 Replies)
Discussion started by: ganapati
4 Replies

7. UNIX for Dummies Questions & Answers

Date/Time Stamp

Hi All, Wondering if there is have a date added at the end of a test string. I have a hypothetical text file day one: John Paul George When the file day one is output, I'd like it to read something like this: John 101406 Paul 101406 George 101406 Day two, when the same text file... (0 Replies)
Discussion started by: JimmyFlip
0 Replies

8. Shell Programming and Scripting

Date Stamp on new file

Dear Gurus, I'm trying to move a number of files from one directory to another directory with a new date stamp. This is my script: #! /bin/csh Today_Date=`date +%Y%M%D` mv /usr/TRS/data/TS* /usr/TRS/backup/TS*.${Today_Date} when i run the script i'm getting the following errors: mv:... (14 Replies)
Discussion started by: lweegp
14 Replies

9. Shell Programming and Scripting

Date Stamp -1

I need to move files after midnight but attach the previous date to it. Moving files before midnight no proproblem but how can I move files which are created on the 22nd for example but add a date stamp of previous day? Date ='date +"Y%m%d"' gets today's date but how can I get yesterday's... (3 Replies)
Discussion started by: candle_66
3 Replies

10. Shell Programming and Scripting

Date Time Stamp

I'm trying to write a script that checks the DTS of a file the compares it to the current time. If greater that 60 mins has gone by and the file has not been written to alert. So far I have the time pulled from the file but I dont know how to compare the times against a 60 min difference. ... (2 Replies)
Discussion started by: jarich
2 Replies
Login or Register to Ask a Question