Stop SCP from deleting the file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Stop SCP from deleting the file
# 1  
Old 08-06-2012
Stop SCP from deleting the file

Hi,

I am trying to scp a file from local server to remote machine as below,
Code:
scp -r $SCPED_FILES"$name"_$code test-vc@es1.global.local:'/cygdrive/d/shares/operations'

File is getting transferred properly but the issue is the original file is being moved (the original copy is deleted). But i want to save the original file.

Please help to achieve this.

Thanks
Guru

Last edited by Franklin52; 08-06-2012 at 07:46 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 08-06-2012
scp doesn't do this per default. Are you sure that there is no other job or coworker in the background, that might have moved or deleted the source file? Does this always occure, whatever file you try to transfer, even from different directories etc.?
# 3  
Old 08-06-2012
hi zaxxon,

Thanks for the reply... When i run the script after commenting the scp command the original file doesnt gets deleted.

I ll check if any other process is deleting the file.

Thanks
# 4  
Old 08-06-2012
You can also set a set -x right before the scp line in the script and a set +x right behind it, so that you can see into what the variables are substituted to, when the script is run.
What happens when you manually transfer the files with scp?
This User Gave Thanks to zaxxon For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

scp one file after another

Hi, I am looking to scp two files in one go, where the second file is sent only if the first one has been fully copied across. I know of the following command that is used to copy multiple files across to one destination server: cp file1.log file2.log user@servername:~/upload Will this... (3 Replies)
Discussion started by: brunlea
3 Replies

2. Shell Programming and Scripting

Avoiding file overwrite during file transfer using scp

Hi, I have written a small script to transfer a file from one unix server to other using scp command which is working fine. As I know with scp, if any file with the same name is already present on destination server, it would get overwritten without any notification to user. Could anyone help me... (14 Replies)
Discussion started by: dsa
14 Replies

3. Debian

Bash script to STOP installation 'if' a file exists...

Hey all, Here's my dilemma: 1. I'm a newbie at scripting! 2. I need to create a script that checks: If a file size is equal to zero, then stop the installation. Is there a way to do this or am I wasting my time??? Thanx in advance! :b: (2 Replies)
Discussion started by: thazsar
2 Replies

4. Shell Programming and Scripting

Cron VPN Client start/scp/stop

Hi, Anyone can help me on how my script will run on crontab, When I manually run my script, it work. But when I put in cron didn't work. #crontab schedule 00 16 * * * /home/scriptdir/myscript.sh # myscript.sh #!/bin/bash echo "mypassword"| sudo -S /etc/init.d/vpnclient_init start cd... (2 Replies)
Discussion started by: fspalero
2 Replies

5. Shell Programming and Scripting

chmod to stop cat from displaying the file?

Hi, Im struggling with what chmod to change the permission of a file in the current directory named MyFile so the command "cat MyFile" fails to display the file.?? (10 Replies)
Discussion started by: tryintolearn
10 Replies

6. Shell Programming and Scripting

How to delete a file using scp

Anyone can share some light how I can use openssh scp command to remove a remote file? scp -u does not work in openssh scp... (4 Replies)
Discussion started by: Leion
4 Replies

7. Shell Programming and Scripting

Stop append to file after 5 minutes

Hi all, I've got a grep command, in which the value (a number) is being appended into a file. Such file will have this output: 100 105 300 204 150 ... ... 120 113 124 This file will continue to append, since the grep line runs every 10 seconds. Is there a way to stop the file... (5 Replies)
Discussion started by: Wizard_1979
5 Replies

8. Shell Programming and Scripting

Start/Stop process when a file is modified.

I have a file which is modified via a web application & this may happen during any time of the day/week. This file is being used a config/list file for another shell script which runs 24hrs with a sleep of 200 secs. I have writted a small script to kill the shell script when this config file is... (4 Replies)
Discussion started by: Lancel0t
4 Replies

9. Shell Programming and Scripting

Shell stop process after found value in file

hi guys can somebody help me here... i've a file that contains total of ip that connects to my server and their ip like this : 80 80 xxx.xxx.xx.xxx 75 75 xxx.xxx.xx.xxx 73 73 xxx.xxx.xx.xxx where first columns and second were the total connections... ... (0 Replies)
Discussion started by: kriezo
0 Replies

10. UNIX for Advanced & Expert Users

how to stop others users to stop viewing what i am doing ?

Hi , I have one question, suppose i am a normal user and when i use 'w' command , it shows who is logged on and what they are doing . Now i want to stop others users to know what i am doing accept the root ? can i do this ? thanks (5 Replies)
Discussion started by: mobile01
5 Replies
Login or Register to Ask a Question