Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help with archiving using find Post 302334898 by TonyFullerMalv on Thursday 16th of July 2009 07:39:39 PM
Old 07-16-2009
Finding a list of old files is usually done with something like:
Code:
# find . -type f -mtime +365

This would list all files in or under the current directory that have not been modified in the last year.

You could move all files older than a year like so:
Code:
# find . -type f -mtime +365 -exec mv {} /archive \;

This would not preserve the directory structure.

You could do something like this to preserve the directory structure:
Code:
# find . -type f -mtime +365 | awk '{ print "mv "$1" /archive/"$1 }' | sed 's/\/\.\//\//' > /tmp/moveoldfiles.sh

check that /tmp/moveoldfiles.sh will do what you intended and then run it.

HTH?

HTH?
 

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
BBACKUPCTL(8)							    Box Backup							     BBACKUPCTL(8)

NAME
bbackupctl - Control the Box Backup client daemon SYNOPSIS
bbackupctl [-q] [-c config-file] command DESCRIPTION
bbackupctl sends commands to a running bbackupd daemon on a client machine. It can be used to force an immediate backup, tell the daemon to reload its configuration files or stop the daemon. If bbackupd is configured in snapshot mode, it will not back up automatically, and the bbackupctl must be used to tell it when to start a backup. Communication with the bbackupd daemon takes place over a local socket (not over the network). Some platforms (notably Windows) can't determine if the user connecting on this socket has the correct credentials to execute the commands. On these platforms, ANY local user can interfere with bbackupd. To avoid this, remove the CommandSocket option from bbackupd.conf, which will also disable bbackupctl. See the Client Configuration page for more information. bbackupctl needs to read the bbackupd configuration file to find out the name of the CommandSocket. If you have to tell bbackupd where to find the configuration file, you will have to tell bbackupctl as well. The default on Unix systems is usually /etc/box/bbackupd.conf. On Windows systems, it is bbackupd.conf in the same directory where bbackupd.exe is located. If bbackupctl cannot find or read the configuration file, it will log an error message and exit. bbackupctl usually writes error messages to the console and the system logs. If it is not doing what you expect, please check these outputs first of all. -q Run in quiet mode. -c config-file Specify configuration file. Commands The following commands are available in bbackupctl: terminate This command cleanly shuts down bbackupd. This is better than killing or terminating it any other way. reload Causes the bbackupd daemon to re-read all its configuration files. Equivalent to kill -HUP. sync Initiates a backup. If no files need to be backed up, no connection will be made to the server. force-sync Initiates a backup, even if the SyncAllowScript says that no backup should run now. wait-for-sync Passively waits until the next backup starts of its own accord, and then terminates. wait-for-end Passively waits until the next backup starts of its own accord and finishes, and then terminates. sync-and-wait Initiates a backup, waits for it to finish, and then terminates. FILES
/etc/box/bbackupd.conf SEE ALSO
bbackupd.conf(5), bbackupd-config(8), bbackupctl(8) AUTHORS
Ben Summers Per Thomsen James O'Gorman Box Backup 0.11 10/28/2011 BBACKUPCTL(8)
All times are GMT -4. The time now is 06:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy