Unable to mput all the files through sftp in the remote server using expect
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm trying to mput
all files present in the directory : /Test/XML/
into a remote sftp server with the help of expect
utility.
I've around 320 files in the directory: /Test/XML/.
The size of each file is around 0.1 MB.
There's no error observed.
Here's my code:
cd /Test/XML/
/usr/bin/expect <<EOF
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
But the problem here is, mput *
is transferring only 4 files instead of transferring all the 320 files.
Not sure, why it's not able to transfer all the 320 files in the remote server.
Any help is most welcome.
linux bash sftp expect
|
show 13 more comments
I'm trying to mput
all files present in the directory : /Test/XML/
into a remote sftp server with the help of expect
utility.
I've around 320 files in the directory: /Test/XML/.
The size of each file is around 0.1 MB.
There's no error observed.
Here's my code:
cd /Test/XML/
/usr/bin/expect <<EOF
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
But the problem here is, mput *
is transferring only 4 files instead of transferring all the 320 files.
Not sure, why it's not able to transfer all the 320 files in the remote server.
Any help is most welcome.
linux bash sftp expect
did you get any error before exist the script ?? i mean connection aborted or something related to proxy ?
– ntshetty
Nov 15 '18 at 9:01
Did you check if you can turn off interactive prompting (PROMPT
command)?
– Mark Setchell
Nov 15 '18 at 9:04
you can also try recursive by replacingmput
withput -r *
so that it will transfer files along with folder if any.
– ntshetty
Nov 15 '18 at 9:06
@ThiruShetty: I ran the script in debug mode.There's no error observed. I need to transfer files only.
– A.K
Nov 15 '18 at 9:16
all files with same extension ?? like .xml ?
– ntshetty
Nov 15 '18 at 9:19
|
show 13 more comments
I'm trying to mput
all files present in the directory : /Test/XML/
into a remote sftp server with the help of expect
utility.
I've around 320 files in the directory: /Test/XML/.
The size of each file is around 0.1 MB.
There's no error observed.
Here's my code:
cd /Test/XML/
/usr/bin/expect <<EOF
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
But the problem here is, mput *
is transferring only 4 files instead of transferring all the 320 files.
Not sure, why it's not able to transfer all the 320 files in the remote server.
Any help is most welcome.
linux bash sftp expect
I'm trying to mput
all files present in the directory : /Test/XML/
into a remote sftp server with the help of expect
utility.
I've around 320 files in the directory: /Test/XML/.
The size of each file is around 0.1 MB.
There's no error observed.
Here's my code:
cd /Test/XML/
/usr/bin/expect <<EOF
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
But the problem here is, mput *
is transferring only 4 files instead of transferring all the 320 files.
Not sure, why it's not able to transfer all the 320 files in the remote server.
Any help is most welcome.
linux bash sftp expect
linux bash sftp expect
edited Nov 15 '18 at 9:55
A.K
asked Nov 15 '18 at 7:09
A.KA.K
307
307
did you get any error before exist the script ?? i mean connection aborted or something related to proxy ?
– ntshetty
Nov 15 '18 at 9:01
Did you check if you can turn off interactive prompting (PROMPT
command)?
– Mark Setchell
Nov 15 '18 at 9:04
you can also try recursive by replacingmput
withput -r *
so that it will transfer files along with folder if any.
– ntshetty
Nov 15 '18 at 9:06
@ThiruShetty: I ran the script in debug mode.There's no error observed. I need to transfer files only.
– A.K
Nov 15 '18 at 9:16
all files with same extension ?? like .xml ?
– ntshetty
Nov 15 '18 at 9:19
|
show 13 more comments
did you get any error before exist the script ?? i mean connection aborted or something related to proxy ?
– ntshetty
Nov 15 '18 at 9:01
Did you check if you can turn off interactive prompting (PROMPT
command)?
– Mark Setchell
Nov 15 '18 at 9:04
you can also try recursive by replacingmput
withput -r *
so that it will transfer files along with folder if any.
– ntshetty
Nov 15 '18 at 9:06
@ThiruShetty: I ran the script in debug mode.There's no error observed. I need to transfer files only.
– A.K
Nov 15 '18 at 9:16
all files with same extension ?? like .xml ?
– ntshetty
Nov 15 '18 at 9:19
did you get any error before exist the script ?? i mean connection aborted or something related to proxy ?
– ntshetty
Nov 15 '18 at 9:01
did you get any error before exist the script ?? i mean connection aborted or something related to proxy ?
– ntshetty
Nov 15 '18 at 9:01
Did you check if you can turn off interactive prompting (
PROMPT
command)?– Mark Setchell
Nov 15 '18 at 9:04
Did you check if you can turn off interactive prompting (
PROMPT
command)?– Mark Setchell
Nov 15 '18 at 9:04
you can also try recursive by replacing
mput
with put -r *
so that it will transfer files along with folder if any.– ntshetty
Nov 15 '18 at 9:06
you can also try recursive by replacing
mput
with put -r *
so that it will transfer files along with folder if any.– ntshetty
Nov 15 '18 at 9:06
@ThiruShetty: I ran the script in debug mode.There's no error observed. I need to transfer files only.
– A.K
Nov 15 '18 at 9:16
@ThiruShetty: I ran the script in debug mode.There's no error observed. I need to transfer files only.
– A.K
Nov 15 '18 at 9:16
all files with same extension ?? like .xml ?
– ntshetty
Nov 15 '18 at 9:19
all files with same extension ?? like .xml ?
– ntshetty
Nov 15 '18 at 9:19
|
show 13 more comments
1 Answer
1
active
oldest
votes
Thanks @ThiruShetty for the hint of using set timeout -1
in the expect
utility.
Actually, i had a lot of files(~320-350) to be transferred(sftp) to a remote server.
With the normal execution of sftp
using expect
utility, it was able to transfer only a few files, not all of them which i wanted.
After inserting set timeout -1
inside expect
, it solved the problem of timeout.
Here's the final code:
cd /Test/XML/
/usr/bin/expect <<EOF
set timeout -1
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314126%2funable-to-mput-all-the-files-through-sftp-in-the-remote-server-using-expect%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks @ThiruShetty for the hint of using set timeout -1
in the expect
utility.
Actually, i had a lot of files(~320-350) to be transferred(sftp) to a remote server.
With the normal execution of sftp
using expect
utility, it was able to transfer only a few files, not all of them which i wanted.
After inserting set timeout -1
inside expect
, it solved the problem of timeout.
Here's the final code:
cd /Test/XML/
/usr/bin/expect <<EOF
set timeout -1
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
add a comment |
Thanks @ThiruShetty for the hint of using set timeout -1
in the expect
utility.
Actually, i had a lot of files(~320-350) to be transferred(sftp) to a remote server.
With the normal execution of sftp
using expect
utility, it was able to transfer only a few files, not all of them which i wanted.
After inserting set timeout -1
inside expect
, it solved the problem of timeout.
Here's the final code:
cd /Test/XML/
/usr/bin/expect <<EOF
set timeout -1
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
add a comment |
Thanks @ThiruShetty for the hint of using set timeout -1
in the expect
utility.
Actually, i had a lot of files(~320-350) to be transferred(sftp) to a remote server.
With the normal execution of sftp
using expect
utility, it was able to transfer only a few files, not all of them which i wanted.
After inserting set timeout -1
inside expect
, it solved the problem of timeout.
Here's the final code:
cd /Test/XML/
/usr/bin/expect <<EOF
set timeout -1
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
Thanks @ThiruShetty for the hint of using set timeout -1
in the expect
utility.
Actually, i had a lot of files(~320-350) to be transferred(sftp) to a remote server.
With the normal execution of sftp
using expect
utility, it was able to transfer only a few files, not all of them which i wanted.
After inserting set timeout -1
inside expect
, it solved the problem of timeout.
Here's the final code:
cd /Test/XML/
/usr/bin/expect <<EOF
set timeout -1
spawn /usr/bin/sftp $user_name@$HOSTNAME
expect "password:"
send "$passwdr"
expect "sftp>"
send "cd /testr"
expect "sftp>"
send "mkdir XMLr"
expect "sftp>"
send "cd /test/XMLr"
expect "sftp>"
send "mput *r"
expect "sftp>"
send "byer"
EOF
answered Nov 17 '18 at 15:38
A.KA.K
307
307
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314126%2funable-to-mput-all-the-files-through-sftp-in-the-remote-server-using-expect%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you get any error before exist the script ?? i mean connection aborted or something related to proxy ?
– ntshetty
Nov 15 '18 at 9:01
Did you check if you can turn off interactive prompting (
PROMPT
command)?– Mark Setchell
Nov 15 '18 at 9:04
you can also try recursive by replacing
mput
withput -r *
so that it will transfer files along with folder if any.– ntshetty
Nov 15 '18 at 9:06
@ThiruShetty: I ran the script in debug mode.There's no error observed. I need to transfer files only.
– A.K
Nov 15 '18 at 9:16
all files with same extension ?? like .xml ?
– ntshetty
Nov 15 '18 at 9:19