Sponsored Content
Top Forums UNIX for Advanced & Expert Users perl script to transfer newly generated files by scp Post 302564262 by tushar_spatil on Thursday 13th of October 2011 08:06:52 AM
Old 10-13-2011
Question perl script to transfer newly generated files by scp

Hi all,

I have root directory on server 1 say A and having sub directory B now my application generates output files and put in sub directory B.
now i need to transfer these files from server1 to server2 by scp which is having same directory structure A and sub directory B
I have tried a lot but seems need ur guidance.


Code:
STAMP=$(perl -e '($ss, $mm, $hh, $DD, $MM, $YY) = localtime(time() - 3600);
printf "%04d%02d%02d%02d%02d", $YY + 1900, $MM + 1, $DD, $hh, $mm')
touch $STAMP /A/B
find /A/B -type f ! -newer /A/B -print -exec scp -r {} server2:/A/B/{} \; | tee -a ./output.txt


Last edited by pludi; 10-13-2011 at 09:17 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to scp as different user in perl script

Hi, I am writing a perl script that needs to change to a another user and scp files to a remote server. The passwords should not be prompted but read from a config file. Please help. Thanks Sandeep (4 Replies)
Discussion started by: sdubey
4 Replies

2. Shell Programming and Scripting

file transfer using scp..

Hi Frdz I have a problem like. I need to transfer a file from source to destination (different systems with different IPs) using "scp" command and before transfer the file i have to check the file is available in destination or not, if it is there no need to transfer, otherwise we have to... (5 Replies)
Discussion started by: KiranKumarKarre
5 Replies

3. UNIX for Dummies Questions & Answers

File transfer using SCP

I have a shell script which uses SCP command to transfer the files from one server to another server. The files are getting transferred successfully, but the problem is the files transferred to the destination server didnot have the permissions as that of the files on the source server. Command... (5 Replies)
Discussion started by: kumarm
5 Replies

4. Shell Programming and Scripting

Problem while scp if bashrc calls Perl script

A weird thing, happened today: When i do SCP from a remote server, file is not getting copied to here. Application Server: Here is where i work, and have a login. I have several tweaks in .bashrc, and along with all those, today i called a PERL script from bashrc. So when ever i do scp from a... (4 Replies)
Discussion started by: thegeek
4 Replies

5. Shell Programming and Scripting

SCP During Transfer to SunOS

Hi, I'd like to seek your help in finding the cause of this problem. I utilize SCP command to transfer files from one server to another. I utilize the return code that SCP return so as to verify if transfer is ok or not. Below is a sample code that I created. if scp... (9 Replies)
Discussion started by: padi
9 Replies

6. UNIX for Advanced & Expert Users

Transfer only modified files by SCP

Hi all, I want to transfer only modified files from one unix server to another unix sever ,tried hard but not succeeded please help me out to resolve it. The script is as below :wall: ssh user@hostname <<EOT >files.txt cd /x/y find . -mtime -0 -type f |\ while read file do echo $file... (8 Replies)
Discussion started by: tushar_spatil
8 Replies

7. UNIX for Advanced & Expert Users

SCP File Transfer

I have 3 AIX server namely - Server 1 , Server 2 and Server 3. And have done SCP setup between Server 1 and Server 2 so that i dont have to give password when i transfer file from Server 1 to Server 2 by setting public key between the server. Q1. If the unix password of the target server... (3 Replies)
Discussion started by: Pash
3 Replies

8. UNIX for Advanced & Expert Users

SCP File Transfer

On unix AIX server, when I am trying to transfer file from one directory to another directory on the same server through a program(where i call the script) it gives error "Lost Connection". (5 Replies)
Discussion started by: Pash
5 Replies

9. Shell Programming and Scripting

Script to multi-transfer splitted files via scp

Hey :3 I am moving some stuff between different servers. I do it like this: scp -r -P 22 -i ~/new.ppk /var/www/bigfile.tar.gz user@123.123.123.123:/var/www/bigfile.tar.gz Lets say, this file is 50 GiB. I would like to know, if its possible to split the file in different parts,... (2 Replies)
Discussion started by: Keenora
2 Replies

10. Shell Programming and Scripting

Script to grep for a string in log files generated in last 15 minutes.

Dear Guru's I've a requirment to grep for a string in series of log files that are getting generated almost every minute. I'm looking to schedule a script every 15 mountes,in order to check if the error string has been generated in any of the log files generated in last 15 minutes. Please... (3 Replies)
Discussion started by: rajivatnova
3 Replies
updmerge(8)						      System Manager's Manual						       updmerge(8)

NAME
updmerge - DO NOT USE THE updmerge UTILITY! SYNOPSIS
/usr/bin/updmerge [-r] directory /usr/bin/updmerge directory /usr/bin/updmerge file directory OPTIONS
Performs a recursive reinstallation of all the files and subdirectories in the /var/adm/install/update area relative to the specified directory. OPERANDS
Specifies the directory from which the reinstallation is relative, typically the root (/) directory. Specifies the name of a file in the update area, or specifies the relative pathname of that file from the update area. DESCRIPTION
Caution DO NOT USE THE updmerge UTILITY! The updmerge utility lets you merge files that have been preserved from a previous installation into a new installation environment. Any user file or customized file from a previous installation that you do not want replaced or overwritten can be saved and reintegrated into a new installation environment. You must have superuser privileges to invoke the updmerge utility, and the system must be in single-user mode. The updmerge utility must be invoked from the /var/adm/install/update directory, which is created by the updmv utility and contains entries for the files that have been preserved from the previous installation. Use the -r option followed by the directory operand to perform a recursive installation of all preserved subdirectories under the /var/adm/install/update area relative to a specific directory. Use the directory operand only to install only those preserved files directly under the /var/adm/install/update directory. This causes a non-recursive merge of the files in the specified directory. If you use the directory operand only, subdirectories in /var/adm/install/update are not merged into the new installation environment. Use the file operand followed by the directory operand to install a single preserved file. This file can be the name of the file in the /var/adm/install/update directory, or it can contain the relative pathname of that file from the /var/adm/install/update directory. If the file operand is a directory name instead of a file name, the updmerge utility reinstalls all files in that directory, but none in its subdirectories. To integrate files from the previous installation into the new installation environment, the updmerge utility compares each preserved file to the newly installed files with the following rules: If the preserved file does not exist on the system, you can view the preserved file before determining whether or not to install it. If the preserved file does exist on the system, you can view the differences between the preserved file and the newly installed file before selecting the file you want installed on the system. If a preserved file is identical to a newly installed file, a message is issued and the next file is checked. EXAMPLES
Recursively install all preserved subdirectories and files under /var/adm/install/update relative to the root (/) directory: updmerge -r / Install the preserved /etc/hosts file relative to the root (/) directory: updmerge etc/hosts / Install the preserved files in the etc directory relative to the root (/) directory (in this case, /etc): updmerge etc / RESTRICTIONS
Caution DO NOT USE THE updmerge UTILITY! You must have superuser privileges to invoke the updmerge utility. The system must be in single-user mode before you invoke the updmerge utility. The updmerge utility must be invoked from the /var/adm/install/update directory. FILES
Storage area created by the updmv utility. SEE ALSO
genufi(8), invsync(8), updmv(8), udetect(8), usync(8) stl_inv(4) updmerge(8)
All times are GMT -4. The time now is 06:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy