Scripting a file move on an FTP ServerHow to loop through each file in FTP directory using a bash scriptLFTP...

How can my story take place on Earth without referring to our existing cities and countries?

Sharing referee/AE report online to point out a grievous error in refereeing

Apex REST API - Unable to set StatusCode to 429

Do launching rockets produce a sonic boom?

Military Uniform of Great Grandfather

Losing queen and then winning the game

What does grep -v "grep" mean and do?

Symbol for "not absolutely continuous" in Latex

Different budgets within roommate group

Why won't the ground take my seed?

Could a Weapon of Mass Destruction, targeting only humans, be developed?

Meaning of じゃないんじゃない?

What does the phrase "building hopping chop" mean here?

What's the rule for a natural 20 on a Perception check?

Is there reliable evidence that depleted uranium from the 1999 NATO bombing is causing cancer in Serbia?

Will a higher security deposit build credit faster with a secured card?

Movie in a trailer park named Paradise and a boy playing a video game then being recruited by aliens to fight in space

Which is better for keeping data primary partition or logical partition?

Find first and last non-zero column in each row of a pandas dataframe

Can two or more lightbeams (from a laser for example) have visible interference when they cross in mid-air*?

Can a nowhere continuous function have a connected graph?

Can I travel from Germany to England alone as an unaccompanied minor?

Put my student loan in parents’ second mortgage - help?

Why is Japan trying to have a better relationship with Iran?



Scripting a file move on an FTP Server


How to loop through each file in FTP directory using a bash scriptLFTP mirror upload only non existing files to remote directoryShell script: whole directory to the remote ftp serverSpeeding up Recursive FTPControlling ftp access with vsftpdFetching data from server by FTP commandCentos 7 FTP Hidden Directory IssueUpload files via FTP client from ftp:/remote-dir to ftp:/remote-dirWant to run and connect to a lightweight FTP server on my own machineCopying MySQL Database via FTP (FileZilla, Ubuntu, Zabbix)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I'm attempting to move multiple files on an FTP server to a different directory. So far, I've written a bash script that will login and retrieve any new files in the remote directory but the ftp command doesn't support a 'mv' command. Essentially the script would download the new file(s) and then once downloaded move the file(s) to a different directory on the same server.



Before you answer please note that this needs to be automated so using a GUI like Filezilla wouldn't help me as I would have to login to various ftp sites and move the files manually, also, keep in mind that I'm unable to ssh into any of the servers as they are managed by other company's and ftp access is all I'm able to get. Last thing, I won't know what the file names are so using a wildcard.










share|improve this question

























  • I think you can find easier solution than moving files. Why do you need to move files, running out of space in a disk?

    – JohnKoch
    57 mins ago


















0















I'm attempting to move multiple files on an FTP server to a different directory. So far, I've written a bash script that will login and retrieve any new files in the remote directory but the ftp command doesn't support a 'mv' command. Essentially the script would download the new file(s) and then once downloaded move the file(s) to a different directory on the same server.



Before you answer please note that this needs to be automated so using a GUI like Filezilla wouldn't help me as I would have to login to various ftp sites and move the files manually, also, keep in mind that I'm unable to ssh into any of the servers as they are managed by other company's and ftp access is all I'm able to get. Last thing, I won't know what the file names are so using a wildcard.










share|improve this question

























  • I think you can find easier solution than moving files. Why do you need to move files, running out of space in a disk?

    – JohnKoch
    57 mins ago














0












0








0








I'm attempting to move multiple files on an FTP server to a different directory. So far, I've written a bash script that will login and retrieve any new files in the remote directory but the ftp command doesn't support a 'mv' command. Essentially the script would download the new file(s) and then once downloaded move the file(s) to a different directory on the same server.



Before you answer please note that this needs to be automated so using a GUI like Filezilla wouldn't help me as I would have to login to various ftp sites and move the files manually, also, keep in mind that I'm unable to ssh into any of the servers as they are managed by other company's and ftp access is all I'm able to get. Last thing, I won't know what the file names are so using a wildcard.










share|improve this question
















I'm attempting to move multiple files on an FTP server to a different directory. So far, I've written a bash script that will login and retrieve any new files in the remote directory but the ftp command doesn't support a 'mv' command. Essentially the script would download the new file(s) and then once downloaded move the file(s) to a different directory on the same server.



Before you answer please note that this needs to be automated so using a GUI like Filezilla wouldn't help me as I would have to login to various ftp sites and move the files manually, also, keep in mind that I'm unable to ssh into any of the servers as they are managed by other company's and ftp access is all I'm able to get. Last thing, I won't know what the file names are so using a wildcard.







linux shell-script ftp lftp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 1:16









Rui F Ribeiro

40.6k16 gold badges89 silver badges150 bronze badges




40.6k16 gold badges89 silver badges150 bronze badges










asked Mar 30 '17 at 20:17









DannyDanny

11 bronze badge




11 bronze badge













  • I think you can find easier solution than moving files. Why do you need to move files, running out of space in a disk?

    – JohnKoch
    57 mins ago



















  • I think you can find easier solution than moving files. Why do you need to move files, running out of space in a disk?

    – JohnKoch
    57 mins ago

















I think you can find easier solution than moving files. Why do you need to move files, running out of space in a disk?

– JohnKoch
57 mins ago





I think you can find easier solution than moving files. Why do you need to move files, running out of space in a disk?

– JohnKoch
57 mins ago










2 Answers
2






active

oldest

votes


















1














Since it appears that you can login successfully with your script, here are the command once that script is logged in.





  • Contrary to common sense the rename command will move files




    rename /path/to/file/to/move /path/to/files/destination/





  • And this should work with a wildcard, for example mp4's




    rename /path/to/files/*.mp4 /path/to/destination/





Hope this is what you were looking for!



Source: https://stackoverflow.com/questions/9461844/how-to-move-files-using-ftp-commands






share|improve this answer


























  • Unfortunately that doesn't work. 'Requested action not taken. File unavailable (file not found or no access).' I have access to the file as I can explicitly name the file to be renamed and it works. The wildcard is what I believe is not working.

    – Danny
    Mar 30 '17 at 20:34











  • "The rename command does not support wildcards." - stackoverflow.com/questions/31180849/… "For example, to retrieve files named myfile1, myfile2, and myfile3 from another computer, at the FTP prompt, enter: mget myfile?" - kb.iu.edu/d/aceu It appears that you can use a ? as a single character wildcard, try that.

    – enconn
    Mar 30 '17 at 22:15













  • Thanks for the suggestion, though, I'm trying to move files within the same ftp server. For example, I downloaded file yyy from the server but now I need to move it to an archive directory. I need a way to script the move without knowing the file names.

    – Danny
    Mar 31 '17 at 13:18



















0














FTP do not have mv command. You have to use rename command



The concept is generate a todo file to rename(move) each file one by one

full script to achieve move more than one file.

1. get file list from ftp server with mls command

2. generate to do list file

2.1 get file , for demo you can do more actions on text file

2.2 rename (move file)

3. execute ftp command with to do list file



#!/bin/sh
clear
# change local directory
cd [local-directory]

#collect file names
ftp -ni ftp.abccompany.com <<EOF
user [user] [password]
cd /OUT
mls abc*.* list.txt
quit
EOF

# create ftp action list
echo >>todo.lst user [user] [password]
while read N
do
#echo >>todo.lst cd /OUT #for demo you can do more actions on text file
#echo >>todo.lst get $N #for demo you can do more actions on text file
echo >>todo.lst rename $N ARCHIVE/$N
done <list.txt

echo >>todo.lst quit

# ftp transfer process
ftp -nv ftp.abccompany.com <todo.lst

# cleanup
rm todo.lst





share|improve this answer










New contributor



chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • (1) After you’ve been on this site for a few months, you will anticipate that, in situations like this, there will always somebody who asks “Will that work for filenames with spaces, tabs, backslashes, asterisks, and other weird characters in them?”  I actually can’t tell whether your code will handle those.  (2) If there are 42 files, then todo.lst will cd /OUT 42 times, without ever cd’ing anywhere else.  Is that necessary? … (Cont’d)

    – Scott
    24 mins ago











  • (Cont’d) …  (3) Can you explain what is happening a little more clearly?  Is the rename command moving files between directories on the server?  If so, why are you getting them, too?  The OP doesn’t really seem to want to make local copies; they are just operating in the belief that the only way to move a file between directories on the FTP server is to download it and re-upload it to the destination.

    – Scott
    24 mins ago











  • Thank you for your opinions. I have update the answer

    – chunhunghan
    1 min ago














Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f354927%2fscripting-a-file-move-on-an-ftp-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Since it appears that you can login successfully with your script, here are the command once that script is logged in.





  • Contrary to common sense the rename command will move files




    rename /path/to/file/to/move /path/to/files/destination/





  • And this should work with a wildcard, for example mp4's




    rename /path/to/files/*.mp4 /path/to/destination/





Hope this is what you were looking for!



Source: https://stackoverflow.com/questions/9461844/how-to-move-files-using-ftp-commands






share|improve this answer


























  • Unfortunately that doesn't work. 'Requested action not taken. File unavailable (file not found or no access).' I have access to the file as I can explicitly name the file to be renamed and it works. The wildcard is what I believe is not working.

    – Danny
    Mar 30 '17 at 20:34











  • "The rename command does not support wildcards." - stackoverflow.com/questions/31180849/… "For example, to retrieve files named myfile1, myfile2, and myfile3 from another computer, at the FTP prompt, enter: mget myfile?" - kb.iu.edu/d/aceu It appears that you can use a ? as a single character wildcard, try that.

    – enconn
    Mar 30 '17 at 22:15













  • Thanks for the suggestion, though, I'm trying to move files within the same ftp server. For example, I downloaded file yyy from the server but now I need to move it to an archive directory. I need a way to script the move without knowing the file names.

    – Danny
    Mar 31 '17 at 13:18
















1














Since it appears that you can login successfully with your script, here are the command once that script is logged in.





  • Contrary to common sense the rename command will move files




    rename /path/to/file/to/move /path/to/files/destination/





  • And this should work with a wildcard, for example mp4's




    rename /path/to/files/*.mp4 /path/to/destination/





Hope this is what you were looking for!



Source: https://stackoverflow.com/questions/9461844/how-to-move-files-using-ftp-commands






share|improve this answer


























  • Unfortunately that doesn't work. 'Requested action not taken. File unavailable (file not found or no access).' I have access to the file as I can explicitly name the file to be renamed and it works. The wildcard is what I believe is not working.

    – Danny
    Mar 30 '17 at 20:34











  • "The rename command does not support wildcards." - stackoverflow.com/questions/31180849/… "For example, to retrieve files named myfile1, myfile2, and myfile3 from another computer, at the FTP prompt, enter: mget myfile?" - kb.iu.edu/d/aceu It appears that you can use a ? as a single character wildcard, try that.

    – enconn
    Mar 30 '17 at 22:15













  • Thanks for the suggestion, though, I'm trying to move files within the same ftp server. For example, I downloaded file yyy from the server but now I need to move it to an archive directory. I need a way to script the move without knowing the file names.

    – Danny
    Mar 31 '17 at 13:18














1












1








1







Since it appears that you can login successfully with your script, here are the command once that script is logged in.





  • Contrary to common sense the rename command will move files




    rename /path/to/file/to/move /path/to/files/destination/





  • And this should work with a wildcard, for example mp4's




    rename /path/to/files/*.mp4 /path/to/destination/





Hope this is what you were looking for!



Source: https://stackoverflow.com/questions/9461844/how-to-move-files-using-ftp-commands






share|improve this answer















Since it appears that you can login successfully with your script, here are the command once that script is logged in.





  • Contrary to common sense the rename command will move files




    rename /path/to/file/to/move /path/to/files/destination/





  • And this should work with a wildcard, for example mp4's




    rename /path/to/files/*.mp4 /path/to/destination/





Hope this is what you were looking for!



Source: https://stackoverflow.com/questions/9461844/how-to-move-files-using-ftp-commands







share|improve this answer














share|improve this answer



share|improve this answer








edited May 23 '17 at 12:39









Community

1




1










answered Mar 30 '17 at 20:22









enconnenconn

931 gold badge1 silver badge6 bronze badges




931 gold badge1 silver badge6 bronze badges













  • Unfortunately that doesn't work. 'Requested action not taken. File unavailable (file not found or no access).' I have access to the file as I can explicitly name the file to be renamed and it works. The wildcard is what I believe is not working.

    – Danny
    Mar 30 '17 at 20:34











  • "The rename command does not support wildcards." - stackoverflow.com/questions/31180849/… "For example, to retrieve files named myfile1, myfile2, and myfile3 from another computer, at the FTP prompt, enter: mget myfile?" - kb.iu.edu/d/aceu It appears that you can use a ? as a single character wildcard, try that.

    – enconn
    Mar 30 '17 at 22:15













  • Thanks for the suggestion, though, I'm trying to move files within the same ftp server. For example, I downloaded file yyy from the server but now I need to move it to an archive directory. I need a way to script the move without knowing the file names.

    – Danny
    Mar 31 '17 at 13:18



















  • Unfortunately that doesn't work. 'Requested action not taken. File unavailable (file not found or no access).' I have access to the file as I can explicitly name the file to be renamed and it works. The wildcard is what I believe is not working.

    – Danny
    Mar 30 '17 at 20:34











  • "The rename command does not support wildcards." - stackoverflow.com/questions/31180849/… "For example, to retrieve files named myfile1, myfile2, and myfile3 from another computer, at the FTP prompt, enter: mget myfile?" - kb.iu.edu/d/aceu It appears that you can use a ? as a single character wildcard, try that.

    – enconn
    Mar 30 '17 at 22:15













  • Thanks for the suggestion, though, I'm trying to move files within the same ftp server. For example, I downloaded file yyy from the server but now I need to move it to an archive directory. I need a way to script the move without knowing the file names.

    – Danny
    Mar 31 '17 at 13:18

















Unfortunately that doesn't work. 'Requested action not taken. File unavailable (file not found or no access).' I have access to the file as I can explicitly name the file to be renamed and it works. The wildcard is what I believe is not working.

– Danny
Mar 30 '17 at 20:34





Unfortunately that doesn't work. 'Requested action not taken. File unavailable (file not found or no access).' I have access to the file as I can explicitly name the file to be renamed and it works. The wildcard is what I believe is not working.

– Danny
Mar 30 '17 at 20:34













"The rename command does not support wildcards." - stackoverflow.com/questions/31180849/… "For example, to retrieve files named myfile1, myfile2, and myfile3 from another computer, at the FTP prompt, enter: mget myfile?" - kb.iu.edu/d/aceu It appears that you can use a ? as a single character wildcard, try that.

– enconn
Mar 30 '17 at 22:15







"The rename command does not support wildcards." - stackoverflow.com/questions/31180849/… "For example, to retrieve files named myfile1, myfile2, and myfile3 from another computer, at the FTP prompt, enter: mget myfile?" - kb.iu.edu/d/aceu It appears that you can use a ? as a single character wildcard, try that.

– enconn
Mar 30 '17 at 22:15















Thanks for the suggestion, though, I'm trying to move files within the same ftp server. For example, I downloaded file yyy from the server but now I need to move it to an archive directory. I need a way to script the move without knowing the file names.

– Danny
Mar 31 '17 at 13:18





Thanks for the suggestion, though, I'm trying to move files within the same ftp server. For example, I downloaded file yyy from the server but now I need to move it to an archive directory. I need a way to script the move without knowing the file names.

– Danny
Mar 31 '17 at 13:18













0














FTP do not have mv command. You have to use rename command



The concept is generate a todo file to rename(move) each file one by one

full script to achieve move more than one file.

1. get file list from ftp server with mls command

2. generate to do list file

2.1 get file , for demo you can do more actions on text file

2.2 rename (move file)

3. execute ftp command with to do list file



#!/bin/sh
clear
# change local directory
cd [local-directory]

#collect file names
ftp -ni ftp.abccompany.com <<EOF
user [user] [password]
cd /OUT
mls abc*.* list.txt
quit
EOF

# create ftp action list
echo >>todo.lst user [user] [password]
while read N
do
#echo >>todo.lst cd /OUT #for demo you can do more actions on text file
#echo >>todo.lst get $N #for demo you can do more actions on text file
echo >>todo.lst rename $N ARCHIVE/$N
done <list.txt

echo >>todo.lst quit

# ftp transfer process
ftp -nv ftp.abccompany.com <todo.lst

# cleanup
rm todo.lst





share|improve this answer










New contributor



chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • (1) After you’ve been on this site for a few months, you will anticipate that, in situations like this, there will always somebody who asks “Will that work for filenames with spaces, tabs, backslashes, asterisks, and other weird characters in them?”  I actually can’t tell whether your code will handle those.  (2) If there are 42 files, then todo.lst will cd /OUT 42 times, without ever cd’ing anywhere else.  Is that necessary? … (Cont’d)

    – Scott
    24 mins ago











  • (Cont’d) …  (3) Can you explain what is happening a little more clearly?  Is the rename command moving files between directories on the server?  If so, why are you getting them, too?  The OP doesn’t really seem to want to make local copies; they are just operating in the belief that the only way to move a file between directories on the FTP server is to download it and re-upload it to the destination.

    – Scott
    24 mins ago











  • Thank you for your opinions. I have update the answer

    – chunhunghan
    1 min ago
















0














FTP do not have mv command. You have to use rename command



The concept is generate a todo file to rename(move) each file one by one

full script to achieve move more than one file.

1. get file list from ftp server with mls command

2. generate to do list file

2.1 get file , for demo you can do more actions on text file

2.2 rename (move file)

3. execute ftp command with to do list file



#!/bin/sh
clear
# change local directory
cd [local-directory]

#collect file names
ftp -ni ftp.abccompany.com <<EOF
user [user] [password]
cd /OUT
mls abc*.* list.txt
quit
EOF

# create ftp action list
echo >>todo.lst user [user] [password]
while read N
do
#echo >>todo.lst cd /OUT #for demo you can do more actions on text file
#echo >>todo.lst get $N #for demo you can do more actions on text file
echo >>todo.lst rename $N ARCHIVE/$N
done <list.txt

echo >>todo.lst quit

# ftp transfer process
ftp -nv ftp.abccompany.com <todo.lst

# cleanup
rm todo.lst





share|improve this answer










New contributor



chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • (1) After you’ve been on this site for a few months, you will anticipate that, in situations like this, there will always somebody who asks “Will that work for filenames with spaces, tabs, backslashes, asterisks, and other weird characters in them?”  I actually can’t tell whether your code will handle those.  (2) If there are 42 files, then todo.lst will cd /OUT 42 times, without ever cd’ing anywhere else.  Is that necessary? … (Cont’d)

    – Scott
    24 mins ago











  • (Cont’d) …  (3) Can you explain what is happening a little more clearly?  Is the rename command moving files between directories on the server?  If so, why are you getting them, too?  The OP doesn’t really seem to want to make local copies; they are just operating in the belief that the only way to move a file between directories on the FTP server is to download it and re-upload it to the destination.

    – Scott
    24 mins ago











  • Thank you for your opinions. I have update the answer

    – chunhunghan
    1 min ago














0












0








0







FTP do not have mv command. You have to use rename command



The concept is generate a todo file to rename(move) each file one by one

full script to achieve move more than one file.

1. get file list from ftp server with mls command

2. generate to do list file

2.1 get file , for demo you can do more actions on text file

2.2 rename (move file)

3. execute ftp command with to do list file



#!/bin/sh
clear
# change local directory
cd [local-directory]

#collect file names
ftp -ni ftp.abccompany.com <<EOF
user [user] [password]
cd /OUT
mls abc*.* list.txt
quit
EOF

# create ftp action list
echo >>todo.lst user [user] [password]
while read N
do
#echo >>todo.lst cd /OUT #for demo you can do more actions on text file
#echo >>todo.lst get $N #for demo you can do more actions on text file
echo >>todo.lst rename $N ARCHIVE/$N
done <list.txt

echo >>todo.lst quit

# ftp transfer process
ftp -nv ftp.abccompany.com <todo.lst

# cleanup
rm todo.lst





share|improve this answer










New contributor



chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









FTP do not have mv command. You have to use rename command



The concept is generate a todo file to rename(move) each file one by one

full script to achieve move more than one file.

1. get file list from ftp server with mls command

2. generate to do list file

2.1 get file , for demo you can do more actions on text file

2.2 rename (move file)

3. execute ftp command with to do list file



#!/bin/sh
clear
# change local directory
cd [local-directory]

#collect file names
ftp -ni ftp.abccompany.com <<EOF
user [user] [password]
cd /OUT
mls abc*.* list.txt
quit
EOF

# create ftp action list
echo >>todo.lst user [user] [password]
while read N
do
#echo >>todo.lst cd /OUT #for demo you can do more actions on text file
#echo >>todo.lst get $N #for demo you can do more actions on text file
echo >>todo.lst rename $N ARCHIVE/$N
done <list.txt

echo >>todo.lst quit

# ftp transfer process
ftp -nv ftp.abccompany.com <todo.lst

# cleanup
rm todo.lst






share|improve this answer










New contributor



chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this answer



share|improve this answer








edited 2 mins ago





















New contributor



chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








answered 1 hour ago









chunhunghanchunhunghan

11 bronze badge




11 bronze badge




New contributor



chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




chunhunghan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • (1) After you’ve been on this site for a few months, you will anticipate that, in situations like this, there will always somebody who asks “Will that work for filenames with spaces, tabs, backslashes, asterisks, and other weird characters in them?”  I actually can’t tell whether your code will handle those.  (2) If there are 42 files, then todo.lst will cd /OUT 42 times, without ever cd’ing anywhere else.  Is that necessary? … (Cont’d)

    – Scott
    24 mins ago











  • (Cont’d) …  (3) Can you explain what is happening a little more clearly?  Is the rename command moving files between directories on the server?  If so, why are you getting them, too?  The OP doesn’t really seem to want to make local copies; they are just operating in the belief that the only way to move a file between directories on the FTP server is to download it and re-upload it to the destination.

    – Scott
    24 mins ago











  • Thank you for your opinions. I have update the answer

    – chunhunghan
    1 min ago



















  • (1) After you’ve been on this site for a few months, you will anticipate that, in situations like this, there will always somebody who asks “Will that work for filenames with spaces, tabs, backslashes, asterisks, and other weird characters in them?”  I actually can’t tell whether your code will handle those.  (2) If there are 42 files, then todo.lst will cd /OUT 42 times, without ever cd’ing anywhere else.  Is that necessary? … (Cont’d)

    – Scott
    24 mins ago











  • (Cont’d) …  (3) Can you explain what is happening a little more clearly?  Is the rename command moving files between directories on the server?  If so, why are you getting them, too?  The OP doesn’t really seem to want to make local copies; they are just operating in the belief that the only way to move a file between directories on the FTP server is to download it and re-upload it to the destination.

    – Scott
    24 mins ago











  • Thank you for your opinions. I have update the answer

    – chunhunghan
    1 min ago

















(1) After you’ve been on this site for a few months, you will anticipate that, in situations like this, there will always somebody who asks “Will that work for filenames with spaces, tabs, backslashes, asterisks, and other weird characters in them?”  I actually can’t tell whether your code will handle those.  (2) If there are 42 files, then todo.lst will cd /OUT 42 times, without ever cd’ing anywhere else.  Is that necessary? … (Cont’d)

– Scott
24 mins ago





(1) After you’ve been on this site for a few months, you will anticipate that, in situations like this, there will always somebody who asks “Will that work for filenames with spaces, tabs, backslashes, asterisks, and other weird characters in them?”  I actually can’t tell whether your code will handle those.  (2) If there are 42 files, then todo.lst will cd /OUT 42 times, without ever cd’ing anywhere else.  Is that necessary? … (Cont’d)

– Scott
24 mins ago













(Cont’d) …  (3) Can you explain what is happening a little more clearly?  Is the rename command moving files between directories on the server?  If so, why are you getting them, too?  The OP doesn’t really seem to want to make local copies; they are just operating in the belief that the only way to move a file between directories on the FTP server is to download it and re-upload it to the destination.

– Scott
24 mins ago





(Cont’d) …  (3) Can you explain what is happening a little more clearly?  Is the rename command moving files between directories on the server?  If so, why are you getting them, too?  The OP doesn’t really seem to want to make local copies; they are just operating in the belief that the only way to move a file between directories on the FTP server is to download it and re-upload it to the destination.

– Scott
24 mins ago













Thank you for your opinions. I have update the answer

– chunhunghan
1 min ago





Thank you for your opinions. I have update the answer

– chunhunghan
1 min ago


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • 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%2funix.stackexchange.com%2fquestions%2f354927%2fscripting-a-file-move-on-an-ftp-server%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

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...