Sponsored Content
Top Forums Shell Programming and Scripting copying a list of files from one machine to another with the same path Post 302435612 by avatar_007 on Wednesday 7th of July 2010 08:10:27 PM
Old 07-07-2010
copying a list of files from one machine to another with the same path

Hello All,

I would like to download a list of files from a remote server to my local machine preserving the path i.e, create a similar directory tree.

ex:
files on the remote machine with path

Code:
/remoteserver/005_S_0221/mpr/m1/I72128/dat/06A515T.dat
/remoteserver/005_S_0221/mpr/m2/I102054/dat/515T.dat
/remoteserver/006_S_0547/mpr/m1/I75279/dat/6A515T.dat
/remoteserver/006_S_0547/mpr/m2/I78722/dat/A515T.dat
/remoteserver/007_S_1339/mpr/m1/I56319/dat/5T.dat
/remoteserver/007_S_1339/mpr/m2/I104363/dat/1515T.dat
/remoteserver/010_S_0786/mpr/m1/I65597/dat/15T.dat

after downloading the path on the local machine should look like this
Code:
/localmachine/005_S_0221/mpr/m1/I72128/dat/06A515T.dat
/localmachine/005_S_0221/mpr/m2/I102054/dat/515T.dat
/localmachine/006_S_0547/mpr/m1/I75279/dat/6A515T.dat
/localmachine/006_S_0547/mpr/m2/I78722/dat/A515T.dat
/localmachine/007_S_1339/mpr/m1/I56319/dat/5T.dat
/localmachine/007_S_1339/mpr/m2/I104363/dat/1515T.dat
/localmachine/010_S_0786/mpr/m1/I65597/dat/15T.dat

On the remote server there are many other files in the directory that i do not want so could not use rsync or scp -r

Thanks in advance
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

copying files to another machine

hello, i need to make a script in which a file on my unix server is copied to another machine using windows operating system in its C:\ drive. both the machines are connected through LAN. (2 Replies)
Discussion started by: rochitsharma
2 Replies

2. UNIX for Advanced & Expert Users

Copying files from 1 machine to another

hi i have a script that works on a file A in unix server. it basically extracts data from file A & put it into another file B. what i need to do is that, i have to copy file B onto another machine having Windows as its operating System. Presently i am doing this manually using FTP. now i need to... (1 Reply)
Discussion started by: rochitsharma
1 Replies

3. UNIX for Dummies Questions & Answers

copying files from one location to another based on a list

I have a text list of about 3,000 file names (image files), which exist on a server and that I want to copy over to another location. I understand the Unix cp code, but what's the string to have it copy multiple files based on an external list? Many thanks! (4 Replies)
Discussion started by: rebornhonest
4 Replies

4. Shell Programming and Scripting

copying unreference files and keeping absolute path

Hi guys, I'm creating a script that basically remove unreference files so at the moment I have something like: DAYS=30 for DIRECTORY in `mount | awk '{ print $7}'` do find $DIRECTORY -type f -atime +$DAYS < ~/files.log done for FILE in `awk '{print $1}' ~/files.log` do cp... (2 Replies)
Discussion started by: hariza
2 Replies

5. UNIX for Dummies Questions & Answers

Copying a list of files from one 'server' to another?

I have two servers. I would like to copy some files from one directory on server A into the same directory on server B. Its not all the files in in the directory, just some of them. Is there a way to make a file list in a txt file and then somehow copy all the files in that list in one go to... (6 Replies)
Discussion started by: Sepia
6 Replies

6. UNIX for Dummies Questions & Answers

latest files copying over to new path

ls -lrt | nawk -v D="$(date +'%b%e:'| sed 's/ //g')" 'D==$6$7":"{sub(".*"$9,$9);print}' This picks only the latest files created based on the timestamp for that particular day.. how do i copy over the same files to a different location???? (1 Reply)
Discussion started by: win4luv
1 Replies

7. Shell Programming and Scripting

Copying List of Files Under Different File Names ?!

Hi to all here , Excuse me for the lamer question but I need UNIX command for copying List of Files Under Different File Names ! for example I have this list: new_001.jpg new_002.jpg new_003.jpg ..... I want to copy all files that start with "new_" to the same directory but under... (7 Replies)
Discussion started by: boboweb_
7 Replies

8. Shell Programming and Scripting

List all the files in the present path and Folders and subfolders files also

Hi, I need a script/command to list out all the files in current path and also the files in folder and subfolders. Ex: My files are like below $ ls -lrt total 8 -rw-r--r-- 1 abc users 419 May 25 10:27 abcd.xml drwxr-xr-x 3 abc users 4096 May 25 10:28 TEST $ Under TEST, there are... (2 Replies)
Discussion started by: divya bandipotu
2 Replies

9. Shell Programming and Scripting

Need help in finding and copying list of files using bash shell script

Dear All, I have a situation where I want to copy some files of type .txt. These files are o/p from one program. Some of the files are named as fileName .txt instead of fileName.txt after fileName by mistake I have specified "space". Now I want to move these files as follows. mv fileName*... (13 Replies)
Discussion started by: linuxUser_
13 Replies

10. UNIX for Beginners Questions & Answers

List all files and copying to different location

Hello All, I want to copy all files from the list below to a path /qa0/repo/AS/CPY (lnx17:qa0:/qa0/repo/AS>) ls -lrt | grep 'Feb 14' -rw-rw-r-- 1 Ks1 qa0 39 Feb 14 20:11 HHH.dat -rw-rw-r-- 1 Ks1 qa0 32 Feb 14 20:11 HHH1.dat -rw-rw-r-- 1 Ks1 qa0 29 Feb 14 20:11... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies
SVN::Notify::Mirror::Rsync(3pm) 			User Contributed Perl Documentation			   SVN::Notify::Mirror::Rsync(3pm)

NAME
SVN::Notify::Mirror::Rsync - Mirror a repository path via Rsync SYNOPSIS
Use svnnotify in post-commit: svnnotify --repos-path "$1" --revision "$2" --handler Mirror::Rsync --to "/path/to/local/htdocs" [--svn-binary /full/path/to/svn] --rsync-host remote_server [--rsync-delete=[yes|no]] [--rsync-dest "/path/on/remote/server"] [--rsync-args arg1 [--rsync-args arg2...]] [[--rsync-ssh] [--ssh-user remote_user] [--ssh-identity /home/user/.ssh/id_rsa]] or better yet, use SVN::Notify::Config for a more sophisticated setup: #!/usr/bin/perl -MSVN::Notify::Config=$0 --- #YAML:1.0 '': PATH: "/usr/bin:/usr/local/bin" 'path/in/repository': handler: Mirror to: "/path/to/www/htdocs" 'some/other/path/in/repository': handler: Mirror to: "/path/to/local/www/htdocs" rsync-host: "remote_host" rsync-dest: "/path/on/remote/www/htdocs" ssh-user: "remote_user" ssh-identity: "/home/user/.ssh/id_rsa" DESCRIPTION
Keep a directory in sync with a portion of a Subversion repository. Typically used to keep a development web server in sync with the changes made to the repository. This directory can either be on the same box as the repository itself, or it can be remote (via SSH connection). USAGE
Depending on whether the target is a "Local Mirror" or a Remote Mirror, there are different options available. All options are available either as a commandline option to svnnotify or as a hash key in SVN::Notify::Config (see their respective documentation for more details). Working Copy on Local host Because 'svn export' is not able to be consistently updated, the local rsync'd directory must be a full working copy. The remote server will only contain the ordinary files (no Subversion admin files). The files in the working copy must be writeable (preferrably owned) by the user identity executing the hook script (this is the user identity that is running Apache or svnserve respectively). Local Mirror Please see " SVN::Notify::Mirror " for details. Remote Mirror Used for directories not located on the same machine as the repository itself. Typically, this might be a production web server located in a DMZ, so special consideration must be paid to security concerns. In particular, the remote mirror server may not be able to directly access the repository box. o rsync-host This value is required and must be the hostname or IP address of the remote host (where the mirror directories reside). o rsync-delete The default mode of operation is to delete remote files which are not present in the local working copy. NOTE: this will delete any unversioned files in the remote directory tree. Unless you have all of your files under version control, you should pass the "--no-rsync-delete" or "--rsync-delete no" option. o rsync-dest This optional value specifies the path to update on the remote host. If you do not specify this value, the same path as passed in as the "--to" parameter will be used (this may not be what you meant to do). o rsync-args This optional parameter can be used to pass additional commandline options to the rsync command. You can use this multiple times in order to pass multiple options. The default args are "--archive --compress". See the "rsync-ssh" options for using SSH instead of RSH (rather than pass those commands via "--rsync-args" o rsync-ssh This optional parameter signals that you wish to use SSH instead of whatever the default remote shell program is configured in your copy of rsync. You may need to set one or more of the "ssh-*" parameters as well. o ssh-user If the remote user is different than the local user executing the postcommit script, you can specify it with this parameter. You would often use this in conjunction with the next parameter. o ssh-identity This value may be optional and should be the full path to the local identity file being used to authenticate with the remote host. If you are setting the ssh-user to be something other than the local user name, you will typically also have to set the ssh-identity. AUTHOR
John Peacock <jpeacock@cpan.org> COPYRIGHT
Copyright (c) 2005-2008 John Peacock This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
SVN::Notify, SVN::Notify::Config, SVN::Notify::Mirror perl v5.14.2 2012-07-04 SVN::Notify::Mirror::Rsync(3pm)
All times are GMT -4. The time now is 04:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy