Archive & move the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Archive & move the file
# 1  
Old 09-02-2010
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/
# 2  
Old 09-02-2010
Code:
mv /ifx01/etldata/lmt/*.xml (or whatever patter you have) /ifx01/etldata/archive/

# 3  
Old 09-02-2010
Code:
cd /ifx01/etldata/lmt/
tar cvf /ifx01/etldata/archive a.xml b.xml && rm a.xml b.xml

# 4  
Old 09-03-2010
Code:
cd /ifx01/etldata/lmt/
mv * ../archive

# 5  
Old 09-08-2010
Thanks for above replies..but the problem is i should nto use rm command & files should be archived & moved(not just moving)
# 6  
Old 09-08-2010
note jagadeeshn04
Quote:
Originally Posted by ygemici
Code:
cd /ifx01/etldata/lmt/
tar cvf /ifx01/etldata/archive a.xml b.xml && rm a.xml b.xml

"&&" provide your needs


ygemici sorry that I interrupted
# 7  
Old 09-08-2010
Code:
bzip2 /ifx01/etldata/lmt/*.xml; mv /ifx01/etldata/lmt/*.bz2 /ifx01/etldata/archive/

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File Move & Sort by Name - Kick out Bad File Names & More

I have a dilemma, we have users who are copying files to "directory 1." These images have file names which include the year it was taken. I need to put together a script to do the following: Examine the file naming convention, ensuring it's the proper format (e.g. test-1983_filename-123.tif)... (8 Replies)
Discussion started by: Nvizn
8 Replies

2. UNIX for Dummies Questions & Answers

Move Directory & Contents Between Two Machines

Hi All, I have a large amount of files that I need to copy from one server to another server using SFTP. Can comeone please help me with the command I would use here? Here is what I am thinking, but being new at this I know this is probably wrong: Login to the destination host using... (1 Reply)
Discussion started by: SalientAnimal
1 Replies

3. UNIX for Dummies Questions & Answers

Archive won't move

I' writing a script trying to archive the oldest two directories from one place, tar them, and move them to another. #!/bin/bash cd (/dir/with/dirforarchiving) ARCHIVE=(/temp/dir/) FIND=$(find . -maxdepth 1 -type d) ARRAY=(`ls ${FIND} -ltd | tail -2`) names=(${ARRAY} ${ARRAY})... (4 Replies)
Discussion started by: jrymer
4 Replies

4. Shell Programming and Scripting

Find & move script

Hi all I wrote a little script that search for a file and moves it, its like this: #!/bin/ksh today=`date +"%d_%m_%y"` if ; then mkdir -p /tmp/bigfiles/$today mv $1 /tmp/bigfiles/$today/ echo "moving big file from /home/appcwec " | mailx -s "bigfile" ffff@yyy.com else ... (4 Replies)
Discussion started by: fretagi
4 Replies

5. Shell Programming and Scripting

Move all files from dir and subdir to Archive with File name as complete path_filename

HI, I need to move all files from a dir & its all subdir to Archive folder which is indise dir only. and moved filename should changed to complete path ( Like Dir_subdir_subdir2_.._filename ). also all files names shoud capture in a file in order to mail I written below code ... (11 Replies)
Discussion started by: minijain7
11 Replies

6. Shell Programming and Scripting

Awk & Move

How can I move all files from last year. I wrote the comamnd but not working. ls -ltr | awk '{if($8~/2009/)print "mv "$9 " remove"}' (7 Replies)
Discussion started by: moe458
7 Replies

7. Shell Programming and Scripting

Move files & folder structure

Hey, this might be a really basic question, but I'm new to Unix scripting. I'm trying to find a command to replicate a file structure from one location to another & move the actual files contained in the base directories, i.e. I have this structure - home/temp/test/dir1/ ... (3 Replies)
Discussion started by: SOCLA_CELT
3 Replies

8. UNIX for Dummies Questions & Answers

sample script to archive & move previous day syslog files

hi all. Please help me with archiving previous day syslog files. the files have no extension and have the format YYYY-MM-DD. I want to archive the file then move it to some other machine. thanks. (2 Replies)
Discussion started by: coolatt
2 Replies

9. UNIX for Advanced & Expert Users

how to archive logs older than 5 days & then delete them?

My code is tar -cvf logs.tar `find /usr/openv/logs/512*.log -mtime +2` && find *.log* -mtime +2 -exec rm {} \; this gives me output as: tar: Missing filenames:confused: (1 Reply)
Discussion started by: timus1980
1 Replies

10. Shell Programming and Scripting

File Compare & Move between 2 servers

Greetings - I am a newbie in shell scripts. I have been thru the whole forum but there has been no similar query posed. The objective of my system is to have a unified filebase system. I am using RSync to synchronise files between the location & central server with both of them having the... (4 Replies)
Discussion started by: evolve
4 Replies
Login or Register to Ask a Question