With LFTP How do I send a specific file to server overwriting if it exists?












1














I'm building an production site update script using expect and lftp.



I'm trying for sometime to do this simple thing: send a file overwriting if it exists. But I just can't find a command that allow me to overwrite destination on put. put -c just continues if it's the same file. But if it's different it does nothing.



Do I really have to check if the file exists and delete it in order to put the file in the server ? isn't there a direct command ?



If that's the only option, then there's another thing I couldn't find: a command to see if the file exists. My only option is to treat ls's output ?



I also accept recommendations if there's another ftp client that allows me to do these things in an easier manner.










share|improve this question
























  • a regular FTP PUT should overwrite the remote file with local by default, innit?
    – vaxquis
    Nov 26 at 15:12










  • Doesn't overwrite in the server I'm using. Tested it.Just to see if had done something wrong last week, I retested it right now. Doesn't overwrite.
    – Nelson Teixeira
    Nov 26 at 15:14












  • put -e should overwrite and remove the file prior to upload. Make sure you use a lowercase e as an uppercase E would actually remove from your local system. See the LFTP man page
    – gravitymixes
    Nov 26 at 15:16
















1














I'm building an production site update script using expect and lftp.



I'm trying for sometime to do this simple thing: send a file overwriting if it exists. But I just can't find a command that allow me to overwrite destination on put. put -c just continues if it's the same file. But if it's different it does nothing.



Do I really have to check if the file exists and delete it in order to put the file in the server ? isn't there a direct command ?



If that's the only option, then there's another thing I couldn't find: a command to see if the file exists. My only option is to treat ls's output ?



I also accept recommendations if there's another ftp client that allows me to do these things in an easier manner.










share|improve this question
























  • a regular FTP PUT should overwrite the remote file with local by default, innit?
    – vaxquis
    Nov 26 at 15:12










  • Doesn't overwrite in the server I'm using. Tested it.Just to see if had done something wrong last week, I retested it right now. Doesn't overwrite.
    – Nelson Teixeira
    Nov 26 at 15:14












  • put -e should overwrite and remove the file prior to upload. Make sure you use a lowercase e as an uppercase E would actually remove from your local system. See the LFTP man page
    – gravitymixes
    Nov 26 at 15:16














1












1








1







I'm building an production site update script using expect and lftp.



I'm trying for sometime to do this simple thing: send a file overwriting if it exists. But I just can't find a command that allow me to overwrite destination on put. put -c just continues if it's the same file. But if it's different it does nothing.



Do I really have to check if the file exists and delete it in order to put the file in the server ? isn't there a direct command ?



If that's the only option, then there's another thing I couldn't find: a command to see if the file exists. My only option is to treat ls's output ?



I also accept recommendations if there's another ftp client that allows me to do these things in an easier manner.










share|improve this question















I'm building an production site update script using expect and lftp.



I'm trying for sometime to do this simple thing: send a file overwriting if it exists. But I just can't find a command that allow me to overwrite destination on put. put -c just continues if it's the same file. But if it's different it does nothing.



Do I really have to check if the file exists and delete it in order to put the file in the server ? isn't there a direct command ?



If that's the only option, then there's another thing I couldn't find: a command to see if the file exists. My only option is to treat ls's output ?



I also accept recommendations if there's another ftp client that allows me to do these things in an easier manner.







lftp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 6:05









marc_s

569k12811001250




569k12811001250










asked Nov 22 at 22:07









Nelson Teixeira

3,67321742




3,67321742












  • a regular FTP PUT should overwrite the remote file with local by default, innit?
    – vaxquis
    Nov 26 at 15:12










  • Doesn't overwrite in the server I'm using. Tested it.Just to see if had done something wrong last week, I retested it right now. Doesn't overwrite.
    – Nelson Teixeira
    Nov 26 at 15:14












  • put -e should overwrite and remove the file prior to upload. Make sure you use a lowercase e as an uppercase E would actually remove from your local system. See the LFTP man page
    – gravitymixes
    Nov 26 at 15:16


















  • a regular FTP PUT should overwrite the remote file with local by default, innit?
    – vaxquis
    Nov 26 at 15:12










  • Doesn't overwrite in the server I'm using. Tested it.Just to see if had done something wrong last week, I retested it right now. Doesn't overwrite.
    – Nelson Teixeira
    Nov 26 at 15:14












  • put -e should overwrite and remove the file prior to upload. Make sure you use a lowercase e as an uppercase E would actually remove from your local system. See the LFTP man page
    – gravitymixes
    Nov 26 at 15:16
















a regular FTP PUT should overwrite the remote file with local by default, innit?
– vaxquis
Nov 26 at 15:12




a regular FTP PUT should overwrite the remote file with local by default, innit?
– vaxquis
Nov 26 at 15:12












Doesn't overwrite in the server I'm using. Tested it.Just to see if had done something wrong last week, I retested it right now. Doesn't overwrite.
– Nelson Teixeira
Nov 26 at 15:14






Doesn't overwrite in the server I'm using. Tested it.Just to see if had done something wrong last week, I retested it right now. Doesn't overwrite.
– Nelson Teixeira
Nov 26 at 15:14














put -e should overwrite and remove the file prior to upload. Make sure you use a lowercase e as an uppercase E would actually remove from your local system. See the LFTP man page
– gravitymixes
Nov 26 at 15:16




put -e should overwrite and remove the file prior to upload. Make sure you use a lowercase e as an uppercase E would actually remove from your local system. See the LFTP man page
– gravitymixes
Nov 26 at 15:16












1 Answer
1






active

oldest

votes


















1





+50









LFTP offers a parameter for put which is a lowercase e.



This allows you to remove the file before uploading it, as opposed to an overwrite option (which LFTP doesn't appear to inherently support). Things like prompt could be available, but if we're strictly discussing LFTP, I would recommend using that option, ala:



put -e file.txt



From the LFTP man pages.






share|improve this answer

















  • 1




    This page is inaccessible from my company's internal network and LFTP's console help doesn't list this option. Thanks. That was what I needed. The reward is yours :) I can only award the reward after 24 hours. After that period I'll give it to you.
    – Nelson Teixeira
    Nov 26 at 15:31













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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438482%2fwith-lftp-how-do-i-send-a-specific-file-to-server-overwriting-if-it-exists%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









1





+50









LFTP offers a parameter for put which is a lowercase e.



This allows you to remove the file before uploading it, as opposed to an overwrite option (which LFTP doesn't appear to inherently support). Things like prompt could be available, but if we're strictly discussing LFTP, I would recommend using that option, ala:



put -e file.txt



From the LFTP man pages.






share|improve this answer

















  • 1




    This page is inaccessible from my company's internal network and LFTP's console help doesn't list this option. Thanks. That was what I needed. The reward is yours :) I can only award the reward after 24 hours. After that period I'll give it to you.
    – Nelson Teixeira
    Nov 26 at 15:31


















1





+50









LFTP offers a parameter for put which is a lowercase e.



This allows you to remove the file before uploading it, as opposed to an overwrite option (which LFTP doesn't appear to inherently support). Things like prompt could be available, but if we're strictly discussing LFTP, I would recommend using that option, ala:



put -e file.txt



From the LFTP man pages.






share|improve this answer

















  • 1




    This page is inaccessible from my company's internal network and LFTP's console help doesn't list this option. Thanks. That was what I needed. The reward is yours :) I can only award the reward after 24 hours. After that period I'll give it to you.
    – Nelson Teixeira
    Nov 26 at 15:31
















1





+50







1





+50



1




+50




LFTP offers a parameter for put which is a lowercase e.



This allows you to remove the file before uploading it, as opposed to an overwrite option (which LFTP doesn't appear to inherently support). Things like prompt could be available, but if we're strictly discussing LFTP, I would recommend using that option, ala:



put -e file.txt



From the LFTP man pages.






share|improve this answer












LFTP offers a parameter for put which is a lowercase e.



This allows you to remove the file before uploading it, as opposed to an overwrite option (which LFTP doesn't appear to inherently support). Things like prompt could be available, but if we're strictly discussing LFTP, I would recommend using that option, ala:



put -e file.txt



From the LFTP man pages.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 at 15:18









gravitymixes

1,62711424




1,62711424








  • 1




    This page is inaccessible from my company's internal network and LFTP's console help doesn't list this option. Thanks. That was what I needed. The reward is yours :) I can only award the reward after 24 hours. After that period I'll give it to you.
    – Nelson Teixeira
    Nov 26 at 15:31
















  • 1




    This page is inaccessible from my company's internal network and LFTP's console help doesn't list this option. Thanks. That was what I needed. The reward is yours :) I can only award the reward after 24 hours. After that period I'll give it to you.
    – Nelson Teixeira
    Nov 26 at 15:31










1




1




This page is inaccessible from my company's internal network and LFTP's console help doesn't list this option. Thanks. That was what I needed. The reward is yours :) I can only award the reward after 24 hours. After that period I'll give it to you.
– Nelson Teixeira
Nov 26 at 15:31






This page is inaccessible from my company's internal network and LFTP's console help doesn't list this option. Thanks. That was what I needed. The reward is yours :) I can only award the reward after 24 hours. After that period I'll give it to you.
– Nelson Teixeira
Nov 26 at 15:31




















draft saved

draft discarded




















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438482%2fwith-lftp-how-do-i-send-a-specific-file-to-server-overwriting-if-it-exists%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks