Script for Taring the all the folderand move into another server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script for Taring the all the folderand move into another server
# 1  
Old 10-22-2010
Script for Taring the all the folderand move into another server

I Need to run a Unix Aix Shell Script should contains

1)Find all the folders in the directory /fss/fin.

2)Tar the Folders.
3)Move the Tar folders into another directory /fs/fi which in server .s11003232sz.net

4)When user requests untar the Folders and move it back to the orignal directory /fss/fi

Please help

Below script is not working since there is no GNU
Code:
#!/usr/bin/ksh
 
#########################################################################################
## THIS SCRIPT BEGINS HERE ##
#########################################################################################
 
#Check for the all folders in the Directory
 
find /fss/fin -type d -name "*" -print
 
# Tar the Folders in the current directory and Move it into separate server directory
 
(cd /fss/fin ; find * -maxdepth 0 -type d -print 0 | xargs -0 tar -cvf -) | 
tar -xf - -C / fs/fi 
 
#########################################################################################
## THIS SCRIPT ENDS HERE ##
#########################################################################################


Last edited by Scott; 10-22-2010 at 09:29 AM.. Reason: Please use code tags
# 2  
Old 10-22-2010
I am not sure why you use such a complicated approach - not to mention that the AIX tar doesn't understand "-maxdepth", because it is no GNU-tar:

Code:
tar -cvf /path/to/tarfile $(find ./* -prune -type d -print)

should more or less do what you want.

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Tar command not taring all files

I am just creating tar.gz file with comand tar -zcvf xyz.tar.gz /home/xyz/* xyz folder contains thousands of files mostly .c, .cpp, etc.. I see that many times all the files are not zipped. Many files(in hundreds) are abruptly left out. What may be the reason for this and how to resolve... (10 Replies)
Discussion started by: rupeshkp728
10 Replies

2. AIX

How to move libraries to another server

Hi, I have compiled FreeTDS on AIX 5.3. Its my dev environment so I have c compilers on the box so I was able to compile. From the test environment onwards I will not be able to have c compilers. I tried to move these files directly to the test environment with the same directory structure but I... (2 Replies)
Discussion started by: vijayraghavk
2 Replies

3. Shell Programming and Scripting

Taring 2 dir together

Hello everyone, I am trying to tar 2 directories together in KSH. tar -cvf temptarfile.tar scripts tar -cvf temptarfile.tar scripts.2 I need all the files in scripts and scripts.2 to be in one tar file. (1 Reply)
Discussion started by: BrutalBryan
1 Replies

4. Shell Programming and Scripting

Recursively UNTARing and then TARing back

I've just finished writing a shell script that searches for a string recursively in all text files and replace them with another string. Now, all these files come from a location nested deep within some TAR files which are inside another mother TAR. To make my script work, we had been UNTARing... (6 Replies)
Discussion started by: exchequer598
6 Replies

5. Shell Programming and Scripting

TARing multiple files at once

Hi guys, I'm trying to write a quick script to archive off some data once a week. So far I have got; DATE=`date +%Y-%m-%d` TARFILE=${DATE}.tar for file in `find /usr/local/DATA/in -mtime +6`; do tar -czvf ${TARFILE} ${file}; done The problem I have is it is going through the results... (2 Replies)
Discussion started by: JayC89
2 Replies

6. Shell Programming and Scripting

script to move files as they generate to another server ?

Im trying to come up with a way to automate moving logs as they generate from one server to another. Anyone have script or idea how most simply to get it done ? want to get this working so dont have to monitor and move these logs during the evening. Thanks for any ideas -Vinman (2 Replies)
Discussion started by: vinman
2 Replies

7. IP Networking

Dedicated Server Move

I just moved a dedicated server, which included moving to a new subnet, and new IP address. Now my server is not reconnecting - I've tried ifconfig, altering the etc/hosts file with the new ip address, with no luck. (5 Replies)
Discussion started by: esmerika
5 Replies

8. UNIX for Dummies Questions & Answers

How to move files while Taring..

Hi, When I run the following command the files get TAR but the files in the folder remain intact. tar -cvf TARZIP.10 Nov09/ Is there any way to move them into the folder than just copying them. Thanks and regards, Gideon. (2 Replies)
Discussion started by: preethgideon
2 Replies

9. Shell Programming and Scripting

how to move a file from one server to another server using FTP in shell script?

I have a file --> file1.txt i need to copy this file to another server using FTP....the 2 servers are server1 and server2..may i know how to write a script that can do this? thanks in advance! Im a newbie to this... (4 Replies)
Discussion started by: forevercalz
4 Replies
Login or Register to Ask a Question