Sponsored Content
Top Forums Shell Programming and Scripting Archive directory script with tar/compress Post 302433583 by AIXfrog on Wednesday 30th of June 2010 04:01:11 AM
Old 06-30-2010
Question Archive directory script with tar/compress

Hi all

I need to write a script that archives all files with a certain date in the filename, to another location.

It has to run on a AIX using tar/compress or another standard AIX tool.

The directory will have x files, each prefixed with a date like yyyymmdd_desc.csv.

I need all to be able to call the script with 4 parameters:
  1. Directory to start in (read from)
  2. Prefixed date (used for file selection)
  3. Directory to place/write the archive in (write to)
  4. Archive filename
After the compress the script also needs to delete all files from the directory that was added to the new archive.

I have been trying to use find, grep, do loops - but has not been able to find a solution Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

tar command with compress option...

Hi ! i have to write a script that archivs homes not used since 3 years. First, my script gathers the users that are concerned, using the following command : ll -lt /home/*/.sh_history | egrep '2000|1999|1998|1997' | awk '{print $3}' i obtain a list like this : user_1 user_2 ...... (3 Replies)
Discussion started by: tomapam
3 Replies

2. UNIX for Advanced & Expert Users

tar and compress

I need to compress and tar a couple files in a directory, but I also want the original files unchanged, ie if I compress a1.cpp , then a1.cpp becomes a1.cpp.z, but what I want after running the compress utility is to have both a1.cpp as it is and a1.cpp.z and then tar a1.cpp.z to an... (4 Replies)
Discussion started by: muru
4 Replies

3. Shell Programming and Scripting

Search, Tar and Compress in one line

Hi all, I am supposed to collect a huge amount of log files from a unix system (HP-UX) onto a local system. The log files are not in one place, but they are scattered all over the Unix server. The unix server has only limited space, so that I can not create a tar file first and then compress it.... (4 Replies)
Discussion started by: bluesky099
4 Replies

4. UNIX for Dummies Questions & Answers

create tar archive without preserving directory structure?

I am adding some individual files to a tar archive and would like them to be added to the archive without any directory hierarchy, even though the files themselves exist in levels of hierarchy. Unfortunately, tar seems to always preserve the directory hierarchy when it adds the files. Here is... (2 Replies)
Discussion started by: Special_K
2 Replies

5. Shell Programming and Scripting

compress directories with .tar extension

hi guys.. Since am a bit new to shell scripting, can anyone help me with this problem please.. i've been struggling with it since 2 days. :( I have a directory lets say myFolder and within it I have sub directories let say myFolder1.tar, myFolder2, myFolder3, etc. I need to write a shell... (12 Replies)
Discussion started by: kanexxx
12 Replies

6. UNIX for Dummies Questions & Answers

Compress the file using Tar command

Hi, When i am tar the file particular ,csv file format in a folder i am receiving the error Command: tar cf New_data.tar /new/file/mari/getdata/small/*.xml Arguements too long But sometimes i am able to compress other folder but the tar folder contains all the file format and... (10 Replies)
Discussion started by: marivinay
10 Replies

7. Shell Programming and Scripting

tar and compress in one step

I know there is a way to tar up directory and sub-directories and have it compressed all in one command but but the syntax escapes me. I seem to re-call something like this: tar -cvf /tmp/file.tar - | compress ? Can somebody please provide me with the syntax on how to tar/compress and... (6 Replies)
Discussion started by: BeefStu
6 Replies

8. Shell Programming and Scripting

script to compress files in directory that changes its name every day

Hi all I have the following script that should compress a file in a directory: # compress log files older than 2 days find /u01/easydone/DBDUMPS/*.dmp -mtime +2 -exec gzip {} \; BUT the problem is that these files that I want to compress are inside a directory with following format: ... (5 Replies)
Discussion started by: fretagi
5 Replies

9. Shell Programming and Scripting

Extract tar archive on remote server in another directory

HI Please suggest how to untar archive on remote sever. When im trying use regular command without any flags everything working fine: $( ssh <user>@<server> -n '. ~/.profile >/dev/null 2>&1 ; cd /path_1 ; copiedIVR_name=`ls -tr | tail -1` ; tar xvf $copiedIVR_name ' ) but i have to ... (1 Reply)
Discussion started by: BACya
1 Replies

10. UNIX for Dummies Questions & Answers

Extract tar archive on remote server in another directory

HI All Please suggest how to untar archive on remote sever. When im trying use regular command without any flags everything is working fine: $( ssh <user>@<server> -n '. ~/.profile >/dev/null 2>&1 ; cd /path_1 ; copiedIVR_name=`ls -tr | tail -1` ; tar xvf $copiedIVR_name ' ) but when im... (9 Replies)
Discussion started by: BACya
9 Replies
CLEANARCH(1p)						User Contributed Perl Documentation					     CLEANARCH(1p)

NAME
cleanarch - Clean a DNSSEC-Tools key archive of old keys SYNOPSIS
cleanarch [options] <keyrec-file | rollrec-file> DESCRIPTION
cleanarch deletes old keys from a DNSSEC-Tools key archive. Key "age" and archives are determined by options and arguments. Command line options and arguments allow selection of archives, keys to delete, amount of output to provide. The options are divided into three groups: archive selection, key selection, and output format. Complete information on options is provided in the OPTIONS section. cleanarch takes a single argument (as distinguished from an option.) This argument may be either a keyrec file or a rollrec file. If the file is a keyrec file, the archive directory for its zone keyrecs are added to the list of archives to clean. If the file is a rollrec file, keyrec files for its zones are searched for the zones' archive directory, and those directories are added to the list of archives to clean. If a zone does not have an archive directory explicitly defined, then the DNSSEC-Tools default will be cleaned. The archives specified by this argument may be modified by archive-selection options. The archive-selection options combine with the keyrec or rollrec file to select a set of archive directories to clean. (Some options can take the place of the file argument.) The key-selection options allow the set of keys to be deleted to contain an entire archive, a particular zone's keys, or all the keys prior to a certain date. The output-format options sets how much output will be given. Without any options selected, the names of keys will be printed as they are deleted. If the -verbose option is given, then the directories selected for searching and the keys selected for deletion will be printed. If the -dirlist option is given, then the directories selected for searching will be printed and no other action will be taken. If the -list option is given, then the keys selected for deletion will be printed and no other action will be taken. cleanarch only cleans the archive directories; the keyrec files are left intact. The cleankrf command should be used in conjunction with cleanarch in order to have a consistent environment. OPTIONS
Archive-Selection Options The following options allow the user to select the archives to be cleaned. -archive directory This option specifies an archive directory to be cleaned. -defarch This option indicates that the default archive directory (named in the DNSSEC-Tools configuration file) should be cleaned. -zone zone This option indicates that zone is the only zone whose archive will be cleaned. If the archive directory is shared by other zones then their keys may also be deleted. Key-Selection Options The following options allow the user to select the keys to be deleted. -all Deletes all keys in the selected archives. This option may not be used with any other key-selection options. -days days Deletes all keys except those whose modification date is within the days full days preceding the current day. -onezone zone Only keys with zone in the key's filename are deleted. This is intended for use in cleaning a multi-zone key archive. This does not validate that zone is an actual zone. Any string can be used here. For example, using "private" will select old private key files for deletion and using "com" will select any filename that contains "com". Options for Output Control The following options allow the user to control cleanarch's output. -dirlist This option lists the selected archive directories. No other action is taken. -list This option lists the selected keys. No other action is taken. -quiet Display no output. -verbose Display verbose output. -Version Displays the version information for cleanarch and the DNSSEC-Tools package. -help Display a usage message and exit. WARNINGS
The user is advised to invest a bit of time testing this tool prior to putting it into production use. Once a key is deleted, it is gone. Some may find this to be detrimental to the health of their DNSSEC-Tools installation. COPYRIGHT
Copyright 2007-2012 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details. AUTHOR
Wayne Morrison, tewok@tislabs.com SEE ALSO
cleankrf(8), lskrf(8), zonesigner(8) Net::DNS::SEC::Tools::keyrec.pm(3), Net::DNS::SEC::Tools::rollrec.pm(3) dnssec-tools.conf(5), keyrec.pm(5), rollrec.pm(5) perl v5.14.2 2012-06-21 CLEANARCH(1p)
All times are GMT -4. The time now is 06:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy