?
Solved

File Copy in FTP

Posted on 2003-03-26
14
Medium Priority
?
348 Views
Last Modified: 2013-11-29
Hello All,
 I am writting a FTP client application.
 I haven't seen any 'copy' command in RFC of FTP.
 Can we copy file present in one folder of FTP server to another folder
 of same FTP server? FTP servers allows to rename a file but not to copy.
 How to do this ?
 Please help?

-Regards,
Dinesh.
 
0
Comment
Question by:dinesh121
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
  • +1
14 Comments
 
LVL 1

Expert Comment

by:cmitch2000
ID: 8216019
Dinesh,

The 'copy'command doen't exist in FTP. Rather, you would use:

put - sends one file
mput - sends multiple files
get - receive one file
Mget - get multiple files

If you type ? (question mark) at an FTP prompt you will see a list of available commands. If you type ? (command) you will see an explanation of what the command does. Hope this helps!
0
 
LVL 1

Expert Comment

by:Sebastien_B
ID: 8217228
Hi Dinesh,

You have two choice :

1) choosing to create a temporary LOCAL copy of your file by a download&delete from the FTP server, and to upload it to the good FTP Folder.(so bandwidth & space consumming...)

2) else (i think it should be the ideal usage) considere using a Telnet connection, then you will be able to open a remote session to manage server contents...

Hope it will help you,
Seb
0
 

Expert Comment

by:truellic
ID: 8222583
hm, maybe you can implement it by opening a connection to localhost at the server

send the file fromthe server to the server.
0
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 

Author Comment

by:dinesh121
ID: 8222822
Hi truellic,
 Can you just describe how to achieve this ?
 I am using winsock control in VB.
 Please help.
 
-Regards,
Dinesh
0
 

Expert Comment

by:truellic
ID: 8222938
i cant help you with the coding - sorry

i just remember that in the good old days when i had nothing better to do i used to even do transfers from one ftp server to another - good old highschool times ;)

play with the pasv and the port commands
0
 
LVL 1

Expert Comment

by:Sebastien_B
ID: 8223051
You can find a sample of VB application using FTP (and other protocols) here : http://www.vbip.com/winsock/winsock_ftp_01.asp
0
 

Author Comment

by:dinesh121
ID: 8223994
Hello truellic,
 I am not asking about coding for FTP.
 I want the mechanism that you used for achieving
 this.
 You can describe the mechanism in terms of FTP commnads
 to achieve what you are saying.
 What commands you send to FTP server to copy files
 from one folder to another ?
 Thanks for previous reply.

-Regards,
Dinesh
 
0
 
LVL 1

Expert Comment

by:Sebastien_B
ID: 8225136
Here is a sample list of command to send to the server to get you want :

-----------------------------------------
open <servename>
<loginname>
<password>
cd <remote_initial_folder>
bin (if binary file to handle) OR asc (if ascii file)
lcd <your_local_temp_path>
get <your_file_name> (OR prompt THEN mget <your_file_pattern>)
cd <remote_target_folder>
put <your file_name> (OR mget <your_pattern>)
quit
-----------------------------------------

Hope that will help you,

Seb
0
 

Author Comment

by:dinesh121
ID: 8229595
Hi Sebastien_B,
  The methos you have shown downloads the file to
  local machine and then uploads it to the destination
  folder of the remote machine.
  But can't we tell FTP server to copy file from one
  of his fodler to aonther one , instead of downloading
  it to local site and then uploading it ?
  The above method you described causes an indirection in
  file copy as it needs the file to be copied on local and
  then to remote site.
 
Please help,
-Regards,
Dinesh.  
   
 
0
 
LVL 1

Accepted Solution

by:
Sebastien_B earned 60 total points
ID: 8229954
As I already told you :

No it's not possible, don't loose from your sight that FTP is a File Transfert Protocol (so the only purpose is to transfer from/to the server)

Your need, sounds much like a Remote Server Management (as it's just like you wish to reorganise files on the Remote server), this kind of usage is typically done thru TELNET.

I hope i was clear enough, you should reconsider your application bases
0
 

Author Comment

by:dinesh121
ID: 8230079
Thanks for your help.
0
 

Expert Comment

by:truellic
ID: 8248236
sorry that i didnt respond for a while - there was something wrong with my email :(

anyway, i think i did that:
http://thibs.menloschool.org/help/ftpviatelnet.html

0
 

Author Comment

by:dinesh121
ID: 8259091
Hi truellic,
 The link that you have mentioned doesn't work.
 Can you put the code on experts-exchange ?  
 I will be very thankful.

-Regards,
Dinesh
 
0
 
LVL 1

Expert Comment

by:Sebastien_B
ID: 8264827
The link is ok, but it's just telling how to use telnet to obtain the same results as with the FTP command.

So it won't help you that much ...it's still file transfer, nothing more,

Pure Telnet (with a shell opened on the remote computer) will be the only solution :)
0

Featured Post

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
This program is used to assist in finding and resolving common problems with wireless connections.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question