Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

moves files remotely using ftp

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 04-01-2010
HemaV HemaV is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 13 December 2013, 2:15 AM EST
Posts: 51
Thanks: 1
Thanked 0 Times in 0 Posts
moves files remotely using ftp

Hi All,
How can i move files from one directory to another in remote server using ftp?

Thanks in Advance,
Sponsored Links
    #2  
Old Unix and Linux 04-01-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 22 June 2015, 6:47 PM EDT
Posts: 6,399
Thanks: 288
Thanked 675 Times in 644 Posts
Without knowing anything about your Operating Systems or ftp software the best guess is to look at the ftp "rename" command. On my machine the command does not take wildcards but it does take full pathnames.



Code:
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /var/tmp
250 CWD command successful.
ftp> rename /var/tmp/myfile /tmp/myfile
350 File exists, ready for destination name.
250 RNTO command successful.
ftp> cd /tmp
250 CWD command successful.
ftp> dir myfile
200 PORT command successful.
150 Opening ASCII mode data connection for /usr/bin/ls.
-rw-r--r--   1 myuser       mygroup              0 Apr  1 15:08 myfile
226 Transfer complete.

Sponsored Links
    #3  
Old Unix and Linux 04-01-2010
HemaV HemaV is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 13 December 2013, 2:15 AM EST
Posts: 51
Thanks: 1
Thanked 0 Times in 0 Posts
Hi,
Thanks for your reply.
I tried the below command and it worked for 1 file. But i am unable to move multiple files (say 1000 files) to another directory through "rename" command. Is there any way i can move multiple files?
    #4  
Old Unix and Linux 04-01-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 22 June 2015, 6:47 PM EDT
Posts: 6,399
Thanks: 288
Thanked 675 Times in 644 Posts
You'll need to use ftp "dir" to get a list of files back to your local server, then use this list to compose a long list of "rename" commands for your ftp script.
Sponsored Links
    #5  
Old Unix and Linux 04-01-2010
HemaV HemaV is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 13 December 2013, 2:15 AM EST
Posts: 51
Thanks: 1
Thanked 0 Times in 0 Posts
Hi,
through dir i got the list of filenames in the specified directory. But now how to use rename command to move 1000 files from one directory to other directory using remote server?

Thank you,
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script that moves itself chmod Shell Programming and Scripting 2 02-02-2006 10:43 AM



All times are GMT -4. The time now is 01:50 AM.