Help on commands in sftp using BatchFile | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Help on commands in sftp using BatchFile

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-09-2013
chococrunch6 chococrunch6 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 20 February 2013, 6:18 AM EST
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Help on commands in sftp using BatchFile

Hi,

The script didn't continue as "20130109" folder is already created on the destination server. Please help.

Entry in script:

Code:
 
cat > $filebatch << __EOF__ 
mkdir $current_date
mkdir $current_date/$fpdomain
cd $current_date/$fpdomain
ls -l
__EOF__

Error:

Code:
 
sftp -b $filebatch id@ipaddress
sftp> 
sftp> mkdir 20130109
Couldn't create directory: Failure

Kindly help,

Regards,
Choco

Last edited by Scott; 01-09-2013 at 07:26 AM.. Reason: Code tags
Sponsored Links
    #2  
Old 01-09-2013
binlib binlib is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 15 March 2013, 10:40 AM EDT
Location: New Jersey
Posts: 380
Thanks: 7
Thanked 90 Times in 75 Posts
From the man page of sftp:

Quote:
-b batchfile
sftp will abort if any of the following commands fail: get, put, rename, ln, rm, mkdir, ... Termination on error can be suppressed on a command by command basis by prefixing the command with a ‘-’ character (for example, -rm /tmp/blah*).
Sponsored Links
    #3  
Old 01-10-2013
chococrunch6 chococrunch6 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 20 February 2013, 6:18 AM EST
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Hi binlib,

Thanks for your reply. can you advise how can i terminate the error using the "mkdir" command?

Regards,
Choco
    #4  
Old 01-10-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 20 September 2014, 3:57 AM EDT
Location: Saskatchewan
Posts: 19,390
Thanks: 790
Thanked 3,270 Times in 3,065 Posts
Manual page text now highlighted for your reading pleasure.

Quote:
-b batchfile
sftp will abort if any of the following commands fail: get, put, rename, ln, rm, mkdir, ... Termination on error can be suppressed on a command by command basis by prefixing the command with a - character (for example, -rm /tmp/blah*).
Sponsored Links
    #5  
Old 01-11-2013
chococrunch6 chococrunch6 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 20 February 2013, 6:18 AM EST
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
hello,

Thank you.. but i already tried with "-" and still not working. Please correct me if I'm wrong with the commands i use

script:
cat > $filebatch << __EOF__

-mkdir $current_date
-mkdir $current_date/$fpdomain
cd $current_date/$fpdomain

error:
sftp> -mkdir 20130111
Invalid command.

Regards,
Choco

Last edited by chococrunch6; 01-11-2013 at 06:30 AM..
Sponsored Links
    #6  
Old 01-11-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 20 September 2014, 3:57 AM EDT
Location: Saskatchewan
Posts: 19,390
Thanks: 790
Thanked 3,270 Times in 3,065 Posts
Thank you for the further details. That should have worked according to the manual, but not all versions of sftp are alike. There's third-party versions, and even commercial ones.

So what's your system?
Sponsored Links
    #7  
Old 01-12-2013
chococrunch6 chococrunch6 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 20 February 2013, 6:18 AM EST
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
hi corona688,

here's the versions of the servers i want to run the script.

SunOS 5.10 Generic_144488-11 sun4v sparc SUNW,SPARC-Enterprise-T5220
SunOS 5.9 Generic_122300-61 sun4u sparc SUNW,Sun-Fire-V890
SunOS 5.10 Generic_142909-17 sun4v sparc SUNW,T5240

Regards,
Choco
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sftp can't fine batchfile "No such file or directory" Fiaran Shell Programming and Scripting 2 07-17-2009 04:51 PM
Passing variables: sftp using -b batchfile j_miller Shell Programming and Scripting 1 11-28-2008 01:34 AM
commands to remote sftp chm0dvii Shell Programming and Scripting 0 08-07-2008 06:23 PM
sftp -b doesn't read the batchfile kmw Shell Programming and Scripting 1 08-04-2008 01:18 PM
Automate batchfile generation for sFTP mpang_ Shell Programming and Scripting 0 04-26-2006 05:34 AM



All times are GMT -4. The time now is 02:02 PM.