sftp process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sftp process
# 1  
Old 11-06-2011
sftp process

Hi,
I have written the following bash shell script for Sftp process,I have already configured the OPEN-SSH server settings and the script is working fine , the script moves files from one folder to another folder within the server itself but the issuse is that when it moves the file from one folder to another then it keeps the files in the source folder also, so in this way the files resides in both the folders but I want the files should onlyt resides in destination folder only....

below is the script ....

Code:
#!/bin/bash

 . /home/p2000/sxs137/scripts/archieve2.config

sftp $userid@$Remoteurl <<EOF
lcd $SrcFolders
cd $DestFolder
mput $SourcefilePattern
exit
EOF

# 2  
Old 11-06-2011
Quote:
Originally Posted by nks342
Hi,
I have written the following bash shell script for Sftp process,I have already configured the OPEN-SSH server settings and the script is working fine , the script moves files from one folder to another folder within the server itself but the issuse is that when it moves the file from one folder to another then it keeps the files in the source folder also, so in this way the files resides in both the folders but I want the files should onlyt resides in destination folder only....

below is the script ....

Code:
#!/bin/bash

 . /home/p2000/sxs137/scripts/archieve2.config

sftp $userid@$Remoteurl <<EOF
lcd $SrcFolders
cd $DestFolder
mput $SourcefilePattern
!rm $SourcefilePattern
exit
EOF

! In Unix, exit to the shell prompt, where you can enter commands. Enter exit to get back to SFTP. If you follow ! with a command (e.g., !pwd), SFTP will execute the command without dropping you to the Unix prompt.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Automate sftp process using script

Hi, guys, I am trying to automate a sftp process using "expect" method (since the key authentication method is disabled in my company network, there is no helping it). In order to try, I type in the command manually: sftp @ > << EOF >cd >ls -l >EOF >Connecting to @servername password: ... (3 Replies)
Discussion started by: warmboy610
3 Replies

2. Shell Programming and Scripting

Using expect command, spawn will not start sftp process

Hi all, I have a script that runs sftp with expect so I can login and send a file in a cronjob. I've installed this on a couple other servers and it has been fine. However, this time on this machine, it seems to be giving me an issue. It won't move past the spawn sftp command and return a... (3 Replies)
Discussion started by: ltyrrell
3 Replies

3. Shell Programming and Scripting

SFTP Process each File!

Hi All, I'm a newbie here in unix. I'm just wondering how can i process each file while in sftp? is it possible? Ex. server1 1.txt 2.txt how can i get the top of the file and process it. output: 1.txt is going to process because it's in the top. i can't figure out how to do it. T_T... (9 Replies)
Discussion started by: nikki1200
9 Replies

4. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

5. Shell Programming and Scripting

Perl SFTP, to get, sort and process every file.

Hi All, I'm niks, and i'm a newbie here and newbie also in perl sorry, i'm just wondering how can i get the file from the other hostname using sftp? then after i get it i'm going to sort the file and process it one by one. sorry because i'm a newbie. Thanks, -niks (4 Replies)
Discussion started by: nikki1200
4 Replies

6. UNIX for Dummies Questions & Answers

Archive files that was already sftp'd/process

Hi, I need to modify my archive script to archive only files which is already sftp to the windows. We encounter some issue which the file is already archiving though it is not yet sftp'd to the Windows. Any answers.?Thanks! (1 Reply)
Discussion started by: sonja
1 Replies

7. UNIX Desktop Questions & Answers

polling using sftp process during a specific time period

Hi all, I need to add a process to poll for the files using sftp during the specific time period .How to i add this to the exsiting script. my requirement is to add a process to the below script which has to poll every 5 min from 5 A.M to 12 P.M. How do i do this? ... (1 Reply)
Discussion started by: narasimha123
1 Replies

8. Shell Programming and Scripting

To execute next UNIX command after ending SFTP process.

Hi, I am trying to run a simple UNIX command after i successfully executed SFTP command as shown below. ----------------------------------------- echo 'Step-1' sftp -vvv -b path exit echo 'Step-2' ------------------------------------------ In above script it executes from the 1st... (3 Replies)
Discussion started by: gautamc
3 Replies

9. Windows & DOS: Issues & Discussions

WRQ Reflection SFTP process hangs when run using windows scheduler

Hi I am doing development on .net framework on Win 2003 box. I am scheduling a job using Windows scheduler to kick off SFTP of files from a local directory to a remotre Unix box. I am using WRQ Reflection Multihost v12.0.7 standard edition for this. Here is how we are scheduling the thing.... (0 Replies)
Discussion started by: kapilash
0 Replies

10. Shell Programming and Scripting

Track Sftp process

Hi, I am using sftp in my bash script. I wanted to know whether if there is any way that we can track whether sftp has been successful or not.. Does sftp return any codes? Thanks in adv (9 Replies)
Discussion started by: borncrazy
9 Replies
Login or Register to Ask a Question