# file transfer



## munna_dude (Mar 19, 2007)

hi all
how can i transfer a file from one system to other
i am using F5 AMD
i tried like this

scp FILE REMOTE
Replace FILE with the path to the file you want to copy, and REMOTE with the system you want to copy it to.

by this can i post my file of any size from my systsem to others
i wanna send a file to one linux system to other linux or windows system

what to do?

can you please give me an example i would like send a file (transfer) by emailid

please help me
thank you in advance


----------



## lotuseclat79 (Sep 12, 2003)

munna_dude said:


> hi all
> how can i transfer a file from one system to other
> i am using F5 AMD
> i tried like this
> ...


Hi munna_dude,

Welcome to TSG!

How are the two systems connected?
1) by network
2) by mounting one on the other

If by network, and both are visible to the other:

# rcp -rp file system2:/pathname
where file is the local file or directory and /pathname is the full pathname on the remote system on the network. The -r does a recursive copy from the local file directory, and the tree structure is preserved at the receiving point of the remote copy operation.

If by mounting one on the other, just use:
# cp -rp file /pathname

where /pathname is the mounted pathname of the remote file system's full path receiving point, and file is either a file or directory that is recursively copied (dir case) to the receiving directory point full pathname.

You stated you wanted to send a file transfer by email, so just use the email attachment facility of your mailer. A common way to send a file via email on a Unix like system is the following:

# mail <file [email protected]
where the file is included instream (e.g. a simple text file usually) using the sendmail facility.

Read the scp man page: # man scp

-- Tom


----------



## munna_dude (Mar 19, 2007)

hi all
i am doing on file selection concept
i got a problem with this code
initially ok_button must be sensitive FALSE
after selecting a file in the list ok_button have set sensitive TRUE
is it possible.
how can i do this

here is the code
which i tried

```
#include <gtk/gtk.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <linux/sockios.h>
#include <string.h>
#include <math.h>
#include <dirent.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>

GtkWidget *filew;
GtkWidget *selection_entry;

/* Get the selected filename and print it to the console */
static void file_ok_sel( GtkWidget        *w,
                         GtkFileSelection *fs )
{
     char *file;
     file=gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));

     g_print ("%s\n",file );

  
}

static void set_selected(GtkWidget        *w,
                         GtkFileSelection *fs,
                         GtkEntry        *entry)
{
  // char *file1;
  /*  file1=gtk_file_selection_get_filename(GTK_FILE_SELECTION(filew));
    if(GTK_FILE_SELECTION (filew)->selection_entry!=NULL)
    { */   
//	gtk_widget_set_sensitive(G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),TRUE);
    //}  
    
    char *file1;
   // file1=gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs));
   // gtk_entry_set_text (GTK_FILE_SELECTION (filew)->selection_entry,file1);

   file1=gtk_entry_get_text (GTK_FILE_SELECTION (fs)->selection_entry);
     g_print ("file1 = %s\n",file1 );

}

int main( int   argc,
          char *argv[] )
{
    //GtkWidget *filew;
    
    gtk_init (&argc, &argv);
    
    /* Create a new file selection widget */
    filew = gtk_file_selection_new ("File selection");
    
    g_signal_connect (G_OBJECT (filew), "destroy",
	              G_CALLBACK (gtk_main_quit), NULL);
    /* Connect the ok_button to file_ok_sel function */
    g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
		      "clicked", G_CALLBACK (file_ok_sel), (gpointer) filew);

   /* Ensure that the dialog box is destroyed when the user clicks a button. */
    g_signal_connect_swapped (GTK_FILE_SELECTION (filew)->ok_button,
                             "clicked",
                             G_CALLBACK (gtk_widget_destroy), 
                             (gpointer) filew);


    gtk_widget_set_sensitive(G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),FALSE); 
    
    /* Connect the cancel_button to destroy the widget */
    g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
	                      "clicked", G_CALLBACK (gtk_widget_destroy),
			      G_OBJECT (filew));

    g_signal_connect(G_OBJECT(GTK_FILE_SELECTION (filew)->selection_entry), "insert_text",
		     G_CALLBACK(set_selected),
		     G_OBJECT (filew)); 


    /* Lets set the filename, as if this were a save dialog, and we are giving
     a default filename */
    gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew), 
				     " ");

    // gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(filew));

    gtk_widget_show (filew);
    gtk_main ();
    return 0;
}
```
can you please help me

thank you in advance


----------



## munna_dude (Mar 19, 2007)

i tried like this
but saying Connection refused
i test it , sending myself

How are the two systems connected?
1) by network

[[email protected] ~]# rcp -rp local 192.168.1.120:/root/Desktop/fileselect/fileselect.c
connect to address 192.168.1.120 port 544: Connection refused
Trying krb4 rcp...
connect to address 192.168.1.120 port 544: Connection refused
trying normal rcp (/usr/bin/rcp)
192.168.1.120: Connection refused
[[email protected] ~]#

is this the correct way to do
please help me 
thank you in advance


----------



## lotuseclat79 (Sep 12, 2003)

munna_dude said:


> i tried like this
> but saying Connection refused
> i test it , sending myself
> 
> ...


Hi munna_dude,
I see you are using the root account on your localhost computer, and you say you are connected by a network - since you are using addresses in the 192.168 range I assume the network is a LAN - is that correct?

For the purpose of discussion, let's call your local (from) computer node in the LAN, the host named FROM. Let's call your receiving (to) computer node in the LAN, the host named TOTO.

If you are trying to do an rcp command from one computer to the other, i.e. from host FROM to host TOTO, then you need to have accounts with the same password common to both host computer nodes. Do you have that? If not, make it so, since you are root - and the root account can do mostly anything since it is an admisistrative level account.

In /user/friendly/file is the file you want to transfer from host node FROM. So, you issue the following commands on host node FROM:

cd /usr/friendly
scp -rp file TOTO:/user/friendly

If you are logged in as user friendly, or as root, the transfer should work. Note: the two different host nodes will have different network addresses - as you referred to one with 192.168.1.120 the other host node would have a different 192.168. address assignment. Let's assume its 192.168.1.121. Then issue:

scp -rp file 192.168.1.121:/user/friendly
which should copy the file to the remote node in directory /usr/friendly.

I used scp in the example because man rcp brought up the scp man page on my Ubuntu 6.0.6 LTS Live CD platform.

-- Tom


----------



## lotuseclat79 (Sep 12, 2003)

You can use ftp to transfer files between systems. Look at the ftp man page for information on how to use it.

-- Tom


----------



## Squashman (Apr 4, 2003)

Lots of ways to do it. You could setup SSH keys between your linux systems and use rsync to copy files to your other Linux system. My friend does this with his Web Servers. He has one Linux system that is just dedicated to backup. He has a cron job setup to run is backup script which uses rsync to backup his servers.


----------



## munna_dude (Mar 19, 2007)

lotuseclat79 said:


> You can use ftp to transfer files between systems. Look at the ftp man page for information on how to use it.
> 
> -- Tom


can i tell the name of the software where i saw a perfect example of file sending

thank you in advance


----------



## munna_dude (Mar 19, 2007)

lotuseclat79 said:


> Hi munna_dude,
> I assume the network is a LAN - is that correct?
> 
> For the purpose of discussion, let's call your local (from) computer node in the LAN, the host named FROM. Let's call your receiving (to) computer node in the LAN, the host named TOTO.
> ...


yes now am in LAN.
i would kine to send a file to all(means to you also) not only mynetworkgroups

i tried this

[[email protected]host ~]# scp -rp /root/Desktop/html.zip 192.168.1.120:/root
[email protected]'s password:
html.zip 100% 7247 7.1KB/s 00:00
[[email protected] ~]#

yes it is fine.
but it asking password.
if i would like to send a file to you. how can i know youe password amd ip address

can you please clarify my doubts

thank you in advance


----------



## munna_dude (Mar 19, 2007)

hi
i tried this also,

[[email protected] ~]# scp -rp /root/Desktop/html.zip 192.168.1.36:/root
ssh: connect to host 192.168.1.36 port 22: Connection refused
lost connection
[[email protected] ~]# rcp -rp /root/Desktop/html.zip 192.168.1.36:/root
connect to address 192.168.1.36 port 544: Connection refused
Trying krb4 rcp...
connect to address 192.168.1.36 port 544: Connection refused
trying normal rcp (/usr/bin/rcp)
192.168.1.36: Connection refused
[[email protected] ~]#

but it is failed

help me in this way

thank you in advance


----------



## lotuseclat79 (Sep 12, 2003)

munna_dude said:


> yes now am in LAN.
> i would kine to send a file to all(means to you also) not only mynetworkgroups
> 
> i tried this
> ...


HI munna_dude,

Ftp or scp or rcp are incapable of sending a file to anyone on the Internet - i.e. the protocols do not work that way in an Internet context as opposed to the way you are using them to send files to your own account/directories on your LAN. This does not mean it is impossible to do so, but involves security and the proper protocol setup at each location - e.g. anonymous ftp or an account/password on a remote system setup with an ftp upload accessible directory.

-- Tom


----------



## munna_dude (Mar 19, 2007)

lotuseclat79 said:


> HI munna_dude,
> 
> Ftp or scp or rcp are incapable of sending a file to anyone on the Internet - i.e. the protocols do not work that way in an Internet context as opposed to the way you are using them to send files to your own account/directories on your LAN. This does not mean it is impossible to do so, but involves security and the proper protocol setup at each location - e.g. anonymous ftp or an account/password on a remote system setup with an ftp upload accessible directory.
> 
> -- Tom


how can i do with curl
is there any command line for file transfer.
can you please send example code for that

help me

thank you in advance


----------

