making a archive script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting making a archive script
# 1  
Old 09-14-2007
making a archive script

Hi All: I'm not much of a script writer so I could use your input. Here's the objective...
Need a script that will archive (tar) files based on date and then move them into an archive directory. The file names are as follows...
S20070101.001 Year month day
S20070102.001
As you can see this may not be too difficult since you are not having to hunt for the actual date created... I would like to be able to keep 2 weeks as flat txt file and then tar up the rest in either a weekly or bi-monthly tar file... This will be on a Solaris 8/10 boxs running k shell.

Thanks all for your input...!!
# 2  
Old 09-15-2007
Quote:
Originally Posted by jimmyc
Hi All: I'm not much of a script writer so I could use your input. Here's the objective...
Need a script that will archive (tar) files based on date and then move them into an archive directory. The file names are as follows...
S20070101.001 Year month day
S20070102.001
As you can see this may not be too difficult since you are not having to hunt for the actual date created... I would like to be able to keep 2 weeks as flat txt file and then tar up the rest in either a weekly or bi-monthly tar file... This will be on a Solaris 8/10 boxs running k shell.

Code:
date=20070102
archivedir=/path/to/wherever/
tar cf "$date.tar" *"$date"*
mv *"$date"* "$archivedir"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to archive logs and sftp to another archive server

Requirement: Under fuse application we have placeholders called containers; Every container has their logs under: <container1>/data/log/fuse.log <container1>/data/log/fuse.log.1 <container1>/data/log/fuse.log.XX <container2>/data/log/fuse.log... (6 Replies)
Discussion started by: Arjun Goswami
6 Replies

2. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies

3. Windows & DOS: Issues & Discussions

Archive Unix script to Batch script

Hi All, I have a requirement to archive processed file and retain the archive based on the quantity.. but this is in windows. I have written a drafted shell script, and would like to have it translated into Batch script.. Please... Below is the drafted shell script ... (2 Replies)
Discussion started by: Dave Null
2 Replies

4. Shell Programming and Scripting

need help archive script

Hi all, I am new to linux and scripting so please forgive me. I need to create a script that will archive files but the max size of the archive need to be 500mb or under. I know about the archiving with parts but i want all the archives as individual archives. Can anyone point me in the correct... (7 Replies)
Discussion started by: craig0
7 Replies

5. Shell Programming and Scripting

Need some help with an archive script

I'm not sure how to solve the $month-1 thingy or the foreach sentence, so I need some help./* folders = folder1 folder2 folder3 folder4 folder5 */ month=`date +%m` if($month == 01) { prev_month = 12 } else { prev_month =... (7 Replies)
Discussion started by: JKMlol
7 Replies

6. Shell Programming and Scripting

Please help in making archive for directories with according to same name

Hello folks, i have folder in that directory /var/qmail/Mail2DB/ from 000,001,002,003 onwards to 198. it means i have total 199 directories start from 000 thru 198. i have another directory /misc, i want to compress each folder /var/qmail/Mail2DB/000 and make a tar file like 000.tar, 0001.tar... (4 Replies)
Discussion started by: learnbash
4 Replies

7. Shell Programming and Scripting

script help .. archive

Hi All We have a landing directory where source system puts files.There are variable number of files and the file names are also varying.Each files successful transmission is identified by a .done file.If file name is xyz.dat then the confirmation file will be xyz.dat.done. I want to... (1 Reply)
Discussion started by: dr46014
1 Replies

8. Shell Programming and Scripting

Archive script

hi guru, can advise how to construct a housekeeping script using perl for the following ? find /var/tmp/logs -name "si*" -type f -exec gzip -f {} \; find /var/tmp/logs -name "*.gz" -type f -exec mv -f {} /var/tmp/log \; I found out those are not working in shell at when put them on... (1 Reply)
Discussion started by: rauphelhunter
1 Replies

9. Shell Programming and Scripting

File Archive Script

Hi There, I want to create a script that will archive files out of a log folder into seperate folders below it, but I need it to keep the previous 2 days worth of information. Now I know I can easily get a script to put the files in there but I don't know how to only get files older than 2 days,... (10 Replies)
Discussion started by: KeesH
10 Replies

10. Shell Programming and Scripting

Archive script old files

Hi All, Im trying to write a script to archive files based on the date the files were created. For example, if a group of files were created on 23rd August,I would have 230806.tar. I have a problem,I want the script to read a separately created file(readarchive.txt) to look for the path to... (1 Reply)
Discussion started by: kayarsenal
1 Replies
Login or Register to Ask a Question