Top Forums Shell Programming and Scripting Copy folder and files from unix server to linux server Post 302688145 by Chubler_XL on Saturday 18th of August 2012 12:43:30 AM
Old 08-18-2012
If you have a reliable and fast network code 1 is quite an acceptable method to use and doesn't require additional space.

If you need to go with code 2 method try and run everything from 1 script on the source machine so you don't have to wait around for archive and network copy to finish so you can start extract. Try and avoid putting .tar file in the same directory you are archiving as tar will pick up it's on file and try to read this in. It's best from a performance viewpoint to have .tar file on a different physical disk.

Pick a small subdirectory (with a small size and a small directory tree) to test scripts with, as you don't want the script running for hours and then find the

code 1:

Source server shell:

-- change directory
cd /usr/local/adm
-- copy source filesystem to target file system tar & extract to target server
tar cf - . | ssh 'cd /usr/local/adm/source.tar ; tar xf -'

Code 2 :

Source server shell:

-- change directory
cd /usr/local/adm

-- Avoid writing to same directory you are archiving as tar will pickup the tar file and try to tar this causing issues. I'd suggest putting the zip in another filesystem preferablly on physically seperate disks for more performance.

tar cf /scratch/source.tar .

-- copy from source to targer server , how to modify the based on server
scp /scratch/source.tar

-- fire restore off on target machine (best done in this script as you can run it unattended, ie you wount have to be around at midnight when scp finishes)

ssh 'cd /usr/local/adm/ ; tar xf /scratch/source.tar'

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can i move data files from a server to unix folder

Hi: I am very new in UNIX environment. I need big help. How I can move data files from a server to UNIX folder by script. I don't want to use ws-ftp. The script should check the file on server, if any file found, move it to UNIX folder. I will be very happy, if some one helps me out.... (1 Reply)
Discussion started by: shah2
1 Replies

2. UNIX for Dummies Questions & Answers

Viewing files of another unix server (in a folder)

I think that's what I'm trying to do. This is the problem: I log onto my comp, Comp1. Then, from the terminal, since my web server is on another comp, I type: xrlogin Comp2, so I log on to that computer. I then navigate to my directory by typing: cd /domain/myDir, so I am in my directory, on the... (3 Replies)
Discussion started by: Djaunl
3 Replies

3. UNIX for Dummies Questions & Answers

copy folder from one server to another

Dear ALL I have two Sco Unix ver 5.0.5 servers and i want to copy one folder from server A (IP to server B(IP I want a script file using maybe "ftp" to do the job Kindly any help (11 Replies)
Discussion started by: sak900354
11 Replies

4. UNIX and Linux Applications

Copy folder and its contents from HP Unix server to RH Linux

I am trying to copy a folder and all its contents from HP Unix box to RH linux, using the following. rsync -avz -e "ssh" /users/www/webroot/docFiles/Division/Ctry And it throws a consistent... (2 Replies)
Discussion started by: FanTom
2 Replies

5. Shell Programming and Scripting

copy files from remote server (B) to target server (A)?

Hi All, what is the comand to log off the remote server? I have 2 servers A, B. I need to find all files older than 7 days on server B and copy over to server A. My logic is: login the remote server: ================= ssh hostB cd /data/test find . -mtime -7 -ls | awk '{print... (4 Replies)
Discussion started by: Beginer0705
4 Replies

6. UNIX and Linux Applications

Need to copy the latest file from Unix server to Shared folder

Hi All, One job in unix server will generate .csv files daily. I need to copy the latest of these .csv file from the unix server to the shared drive/folder in windows through unix script. My shared folder will look something like W:\some folder(for example). Could any one of you please help... (3 Replies)
Discussion started by: jaya@123
3 Replies

7. Shell Programming and Scripting

Unix shell script to Copy files from one Windows server to another Windows server.

Can anybody please help me on how to code for the below requirement: I need to write a shell script (on different unix server) to copy files from multiple folders (ex. BRN-000001) from one windows server (\\boldls-mwe-dev4)to a different windows server(\\ This shell... (4 Replies)
Discussion started by: SravsJaya
4 Replies

8. Shell Programming and Scripting

Copy files from Linux server to Windows server

Hi All, I am generating report in a Linux server and once the report is generated the report(.txt file) needs to be automatically saved in a Windows servers. So i am looking for a script to transfer the file automatically from Linux server to Windows server? Please advise. Thanks... (3 Replies)
Discussion started by: arunmanas
3 Replies

9. UNIX for Dummies Questions & Answers

Copy files from Linux server local windows machine using a shell script

Hello, I need to create a shell script which will copy files - which are created on particular date and starting with particular name - to local windows XP machine. Is this possible.? Currently it is being done manually using winscp (1 Reply)
Discussion started by: NarayanaPrakash
1 Replies

10. Shell Programming and Scripting

Copy multiple .txt files from one server to another server

:wall:Hi all, I have two servers : server A and server B Weekly wise i use to receive files to server A to one particular location say /source/location . NOTE: In this location there will be other files also present other than these weekly arrival 18 files. My task : i need a... (7 Replies)
Discussion started by: karmegam
7 Replies
virt-tar-out(1) 					      Virtualization Support						   virt-tar-out(1)

virt-tar-out - Pack a virtual machine disk image directory into a tarball. SYNOPSIS
virt-tar-out -a disk.img /dir files.tar virt-tar-out -d domain /dir files.tar virt-tar-out -d domain /dir - | gzip --best > files.tar.gz DESCRIPTION
"virt-tar-out" packs a virtual machine disk image directory into a tarball. The first parameter is the absolute path of the virtual machine directory. The second parameter is the tar file to write. Use "-" to write to standard output. EXAMPLES
Download the home directories from a guest: virt-tar-out -d MyGuest /home - | gzip --best > homes.tar.gz JUST A SHELL SCRIPT WRAPPER AROUND GUESTFISH
This command is just a simple shell script wrapper around the guestfish(1) "tar-out" command. For anything more complex than a trivial copy, you are probably better off using guestfish directly. OPTIONS
Since the shell script just passes options straight to guestfish, read guestfish(1) to see the full list of options. SEE ALSO
guestfish(1), virt-cat(1), virt-copy-in(1), virt-copy-out(1), virt-edit(1), virt-tar-in(1), AUTHORS
Richard W.M. Jones ("rjones at redhat dot com") COPYRIGHT
Copyright (C) 2011-2012 Red Hat Inc. LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BUGS
To get a list of bugs against libguestfs, use this link: To report a new bug against libguestfs, use this link: When reporting a bug, please supply: o The version of libguestfs. o Where you got libguestfs (eg. which Linux distro, compiled from source, etc) o Describe the bug accurately and give a way to reproduce it. o Run libguestfs-test-tool(1) and paste the complete, unedited output into the bug report. libguestfs-1.22.6 2013-08-24 virt-tar-out(1)

Featured Tech Videos

All times are GMT -4. The time now is 09:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy