Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

File Copy in FTP

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
dinesh121
Asked:
dinesh121
  • 5
  • 5
  • 3
  • +1
1 Solution
 
cmitch2000Commented:
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
 
Sebastien_BCommented:
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
 
truellicCommented:
hm, maybe you can implement it by opening a connection to localhost at the server

send the file fromthe server to the server.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dinesh121Author Commented:
Hi truellic,
 Can you just describe how to achieve this ?
 I am using winsock control in VB.
 Please help.
 
-Regards,
Dinesh
0
 
truellicCommented:
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
 
Sebastien_BCommented:
You can find a sample of VB application using FTP (and other protocols) here : http://www.vbip.com/winsock/winsock_ftp_01.asp
0
 
dinesh121Author Commented:
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
 
Sebastien_BCommented:
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
 
dinesh121Author Commented:
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
 
Sebastien_BCommented:
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
 
dinesh121Author Commented:
Thanks for your help.
0
 
truellicCommented:
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
 
dinesh121Author Commented:
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
 
Sebastien_BCommented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 5
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now