Archive old file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Archive old file
# 1  
Old 03-27-2014
Archive old file

Hi All,

I have the below senario.

File_Name="^Test>*"
Move_Delay=12
Source_Folder="/odi/nas/"
Target_Folder="/odi/nas//archive"

Now I want to move any file that is older than "Move_Delay" hours and matching "File_Name" pattern from the folder "Source_Folder" to the folder "Target_Folder".


Please guide me.
# 2  
Old 03-27-2014
RedHat

Hi Anupam,

You can use to move files older then 12 Days

Code:
 find  $Source_Folder -type f -mtime +12 | xargs cp -t $Target_Folder

---------- Post updated at 12:32 PM ---------- Previous update was at 12:28 PM ----------

For 12 Hours use -mtime +0.5
# 3  
Old 03-27-2014
I think this will move files from sub directory as well. I don't want to move files from sub directory.
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. Programming

Extract part of an archive to a different file

I need to save part of a file to a different one, start and end offset bytes are provided by two counters in long format. If the difference is big, how should I do it to prevent buffer overflow in java? (7 Replies)
Discussion started by: Tribe
7 Replies

3. Homework & Coursework Questions

Creating and extracting archive file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi there, I wish to create a single .tar file of the current directory but have literally no idea on where to... (8 Replies)
Discussion started by: Banned
8 Replies

4. Shell Programming and Scripting

Problem in test file operator on a ufsdump archive file mount nfs

Hi, I would like to ask if someone know how to test a files if exist the file is a nfs mount ufsdump archive file.. i used the test operator -f -a h almost all test operator but i failed file1=ufs_root_image.dump || echo "files doesn't exist && exit 1 the false file1 is working but... (0 Replies)
Discussion started by: jao_madn
0 Replies

5. Shell Programming and Scripting

Archive & move the file

I have a set of files in path /ifx01/etldata/lmt/ a.xml b.xml I have to archive & move these files to path /ifx01/etldata/archive ,so that not even the original files should exists. After acrhiving there should be no files in path /ifx01/etldata/lmt/ (6 Replies)
Discussion started by: jagadeeshn04
6 Replies

6. Shell Programming and Scripting

Extracting from archive | compressing to new archive

Hi there, I have one huge archive (it's a system image). I need sometime to create smaller archives with only one or two file from my big archive. So I'm looking for a command that extracts files from an archive and pipe them to another one. I tried the following : tar -xzOf oldarchive.tgz... (5 Replies)
Discussion started by: chebarbudo
5 Replies

7. 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

8. UNIX for Dummies Questions & Answers

create a archive of old file

i need a script which will create a archive of the files older than 10 days........ (2 Replies)
Discussion started by: jayaramanit
2 Replies

9. UNIX for Dummies Questions & Answers

Extracting from a tar archive file

Can I extract files from an archive file (tar), where the filename includes the full directory path, to a different directory? For example the archive files may have a filename of /SrcFiles/XXX/filename.dat and I want to extract it to /SrcFiles/YYY/filename.dat. Since the archive file was... (1 Reply)
Discussion started by: nmalencia
1 Replies

10. UNIX for Dummies Questions & Answers

Script to archive file

Hi All, I am trying to archive a file. I have the script to archive a file which is given below: #! /usr/bin/sh INITFILE="US_Recon" INITDIR="/var/opt/l2/CSN1/ap21" TMPDIR="/var/opt/sap2bn/out/CSN1/ap21/tmp" ARCHDIR="/var/opt/l2/CSN1/ap21" FINALDIR="/var/opt/sap2bn/out/CSN1/ap21"... (0 Replies)
Discussion started by: indira
0 Replies
Login or Register to Ask a Question