Compress a particular month files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Compress a particular month files
# 1  
Old 04-28-2011
Compress a particular month files

Hi ALL,

I am working on a folder where there are lot of files for the past one year. I need to compress a particular month files alone. suppose i need to compress the feb month files alone, what is the script we can use.

Thanks in advance
# 2  
Old 04-28-2011
By compress I take it to mean you want to compress each file:
Feb 2011
Code:
touch -t 201101302359.59  start_dummy
touch -t 201102282359.59  end_dummy
find /path/to/directory \( -newer start_dummy -a ! - newer end_dummy \)  |
while read fname
do
     compress $fname
     # or use
     # gzip $fname
done

# 3  
Old 04-28-2011
Apologies for not being clear

let us take a directory which contain 100 files. out of which there are 40 files belonginf to the month of FEbruary. I need a single script which should pick all the feb files and compress them(Instead of manually compressing each file one by one)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need last month files after 10th of every month

Hi, I need all file names in a folder which has date >= 10th of last month, Example : files in folder AUTO_F1_20140610.TXT BUTO_F1_20140616.TXT CUTO_F1_20140603.TXT FA_AUTO_06012014.TXT LA_AUTO_06112014.TXT MA_AUTO_06212014.TXT ZA_AUTO_06232014.TXT Output: AUTO_F1_20140610.TXT... (9 Replies)
Discussion started by: nani1984
9 Replies

2. UNIX for Dummies Questions & Answers

How do I compress all files in a directory?

the problem states "Write a script that compresses all the files in the directory. Make a directory and put some files in it. Also make a sub directory in your directory and put files in it also. Once you have this basic ability to compress all files within a directory, add to your script a menu of... (1 Reply)
Discussion started by: Brittany
1 Replies

3. UNIX for Dummies Questions & Answers

Issue: Compress in unix server and FTP to windows and open the compress file using Winzip

Hi All ! We have to compress a big data file in unix server and transfer it to windows and uncompress it using winzip in windows. I have used the utility ZIP like the below. zip -e <newfilename> df2_test_extract.dat but when I compress files greater than 4 gb using zip utility, it... (4 Replies)
Discussion started by: sakthifire
4 Replies

4. UNIX for Advanced & Expert Users

compress the log files

Hi, I have an application which creates the logs in a date wise. like, tomcat_access_log.2009-09-12.log tomcat_access_log.2009-09-11.log tomcat_access_log.2009-09-10.log tomcat_access_log.2009-09-09.log tomcat_access_log.2009-09-08.log tomcat_access_log.2009-09-07.logNow my requirement is... (5 Replies)
Discussion started by: skmdu
5 Replies

5. UNIX for Dummies Questions & Answers

How to compress files without extension

Could someone please help? I'm trying to compress all the files in a directory without extension. I know for typical files with extension, the command is something like: tar -zcvf file.tar.gz *.doc What is the command for files without extension? Thanks. (4 Replies)
Discussion started by: AChan1118
4 Replies

6. Shell Programming and Scripting

compress files

Could someone give me an idea how to compress all files from a given directory that are not of type .z (compressed). Please help. (2 Replies)
Discussion started by: lesstjm
2 Replies

7. Filesystems, Disks and Memory

Compress files on NAS

Hello, I am having difficulty compressing the files using compress or GZIP utility on NAS share NFS mounted on my linux server. Any one have idea on how to do this ? I get the followign error but the trying to compress the files STRP2> compress STR_OUTBOUND_CDM_LOG_LOB.PRT2008_26.txt... (0 Replies)
Discussion started by: kamathg
0 Replies

8. UNIX for Dummies Questions & Answers

Compress files

Hi All, I would like to archive some of the scripts below(USFINUM042006_01.CSV USFINUM042006_02.CSV and USFINUM042006_03.CSV )and also use a wildcard e.g. <command> USFINUM*.CSV. Also there are a lot of similar files but I want only the three latest files to be compressed. Which is the best... (3 Replies)
Discussion started by: indira
3 Replies

9. Shell Programming and Scripting

Compress multiple files

Hi Friends, Can anyone help me out with compressing multiple files. I have multiple files in directory , I have to compress these into a single file, I tried using gzip -r outfile.gz file1 file2 file3. It is not working Thanks in advance for your help S :) (5 Replies)
Discussion started by: sbasetty
5 Replies

10. UNIX for Dummies Questions & Answers

How to Compress log files?

Hi, I have my log files in /home/user1/temp2/logs i want to archive *.log and *.txt files and to store in my /home/user1/temp2/archved/ with *.log with Time stamp ,Please let me know how to do this? (1 Reply)
Discussion started by: redlotus72
1 Replies
Login or Register to Ask a Question