Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help with archiving using find Post 302334838 by jaison75 on Thursday 16th of July 2009 04:10:48 PM
Old 07-16-2009
Help with archiving using find

Dear Unix Experts,

I am trying to backup some legacy data based on date. I am pasting a small portion from the ls -al command from my session for reference.

Code:
athena>ls -al

./nmr/exam1d_13C:
total 32
drwxrwxrwx    3 root     root         4096 May  1  2008 1/
drwxrwxrwx    3 root     root         4096 Apr 11  2008 2/
drwxrwxrwx   14 root     root         4096 Jan 22  2008 ../
drwxrwxrwx    3 root     root         4096 Jan 13  2005 6/
drwxrwxrwx    3 root     root         4096 Jan 13  2005 5/
drwxrwxrwx    8 root     root         4096 Mar 30  2004 ./

./nmr/exam2d_HC:
total 24
drwxrwxrwx    3 root     root         4096 Apr 11  2008 1/
drwxrwxrwx    3 root     root         4096 Dec 21  2004 4/
drwxrwxrwx   14 root     root         4096 Jan 22  2008 ../
drwxrwxrwx    6 root     root         4096 Mar 30  2004 ./

I am trying to archive these files based on the year like below. Just to complicate things a little bit more, I expect to see sub-directories like 1/ 2/ and so on. under ./nmr/exam1d_13C/1 etc.

Code:
./nmr/exam1d_13C/1 to /archive/2008/nmr/exam1d_13C/1
./nmr/exam1d_13C/2 to /archive/2008/nmr/exam1d_13C/2
./nmr/exam1d_13C/5 to /archive/2005/nmr/exam1d_13C/5
./nmr/exam1d_13C/6 to /archive/2005/nmr/exam1d_13C/6
./nmr/exam2d_HC/1 to /archive/2008/nmr/exam2d_HC/1
./nmr/exam2d_HC/4 to /archive/2008/nmr/exam2d_HC/4


I am stuck. I tried using find, but with no success. I would appreciate any help.

Thanks
Jaison


Next time use CODE-tags when posting code, data or logs to enhance readability and keep formatting like indention etc., ty.

Last edited by zaxxon; 07-17-2009 at 01:34 AM.. Reason: code tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Archiving

I am looking for some advice. I have some files on a Unix server, which contain symbolic links. I need to copy these over to a nfts environment, but wish to keep the symbolic links intact. Any ideas? (7 Replies)
Discussion started by: rmasonuk
7 Replies

2. Shell Programming and Scripting

Archiving Users

Hello Gurus, I have a requirement where I have to remove users that have not logged into our unix box last 90 days. I want to script this one and remove the users automatically now and then. Has any one ever done this before, if so please give me some sample code. I am not a good unix... (2 Replies)
Discussion started by: suseesk
2 Replies

3. Shell Programming and Scripting

Archiving

Hi, I want to archive below directory ex: /home/oracle/dd0 sub-directories in dd0 /home/oracle/dd0/backup/backup1 /home/oracle/dd0/backup/backup2 /home/oracle/dd0/dmp ....etc I want a command(tar) which will let me archive the above directory excluding *.dmp(dump files), *.log(log... (1 Reply)
Discussion started by: dreams5617
1 Replies

4. UNIX for Dummies Questions & Answers

Archiving Problem

Hi friends I work on UNIX Operating system and I have many servers. ADM server make archiving for special data every day inside XYZ directory at specific time,the next time SPERADM server will take that archiving data to put them in same directory (inside SPERADM server). Now archiving... (2 Replies)
Discussion started by: bintaleb
2 Replies

5. Shell Programming and Scripting

Archiving by Time

Hi all. I am trying to set up archiving of directories, such that I keep every directory made in the past week, but just one directory per week beyond that. Using the find command, I can easily delete everything more than one week old, but can not figure out how to save one. Each directory... (4 Replies)
Discussion started by: aefskysa
4 Replies

6. Shell Programming and Scripting

Archiving the files

Hi, Suppose I have 2 files of yesterday's. And today I have received 3 files. Before processing anything I want to archieve the 2 files of yesterday's into a different folder. How can this be done? Regards, Sunitha (1 Reply)
Discussion started by: Sunitha_edi82
1 Replies

7. Shell Programming and Scripting

Archiving in Perl

Hi Guys i am experiencing this problem when trying to archive a file in perl. the files name is created dynamically. (my $date = `date +"%d%m%Y"`;) `tar czf /opt/memex/backups/Complete$date.tar.gz /opt/memex/backups/Complete$date`; error message: tar: Cowardly refusing to create an empty... (4 Replies)
Discussion started by: Grant Pryor
4 Replies

8. Shell Programming and Scripting

Help for backup and archiving

Hi, I am trying to develop a KSH script, to perform the following functions: 1. ZIP the previous day backup to ZIP Directory, while removing any ZIP file older than a week. 2. Perform the backup. 3. Send a confirmation mail with subject content of the size of file. Please let me... (0 Replies)
Discussion started by: johnprince1980
0 Replies

9. Shell Programming and Scripting

Logs archiving

Hi , Might be the very basic question and most frequent one also.. wanted to archive the logs/files older than one month or older than 30 days to some particular location. File/log format is like below ABCD_EF_GHIJ_Defaulter_Report_(06-Jun-2014_11-50-20_AM) Source : /test/ABC... (3 Replies)
Discussion started by: Riverstone
3 Replies
root_archive(1M)					  System Administration Commands					  root_archive(1M)

NAME
root_archive - manage bootable miniroot archives SYNOPSIS
/boot/solaris/bin/root_archive pack archive root /boot/solaris/bin/root_archive unpack archive root /boot/solaris/bin/root_archive packmedia solaris_image root /boot/solaris/bin/root_archive unpackmedia solaris_image root DESCRIPTION
The root_archive utility is used to manage bootable miniroot archives and is currently only available on x86 platforms. The utility can pack and unpack boot/root archives in both ufs and hsfs (iso9660) format. It will always generate ufs archives. root_archive also uses the lofi file driver to export a file as a block device (see lofi(7D)) and mount to mount or unmount file systems and remote resources (see mount(1M)). root_archive requires the same privileges that are needed to run these commands. SUBCOMMANDS
The root_archive command has the following subcommands: pack archive root Pack from the image found under the root directory to the archive. unpack archive root Unpack from the archive to an unpacked image under the root directory. packmedia solaris_image root Pack the solaris image to the root directory. unpackmedia solaris_image root Unpack the solaris image from the root directory. For packmedia and unpackmedia, other items that do not go into the ramdisk image are copied or uncopied (see cpio(1)) as well. Specifi- cally, this includes all the packaging databases needed for pkgadd and the other packaging utilities to succeed which are not used in the running and hence pruned to conserve memory. EXAMPLES
Example 1 Unpacking the Solaris x86 install image The following command unpacks the current Solaris image from the root directory: # root_archive unpackmedia /export/nv/solarisdvd.nvx_dvd/latest /export/Boot Where /export/nv/solarisdvd.nvx_dvd/latest represents a path to a Solaris x86 install image and /export/Boot is a directory that will be purged or created, as necessary. Example 2 Packing the Solaris x86 install image The following command packs the current Solaris image to the root directory: # root_archive packmedia /export/nv/solarisdvd.nvx_dvd/latest /export/Boot EXIT STATUS
The following exit values are returned: 0 The command completed successfully. 1 The command exited due to an error. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Stable | +-----------------------------+-----------------------------+ SEE ALSO
cpio(1), bootadm(1M), mount(1M), attributes(5), lofi(7D) SunOS 5.11 26 Sep 2005 root_archive(1M)
All times are GMT -4. The time now is 01:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy