Thread: copy command

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    136

    copy command

    hi all
    sorry for this query.. it is a unix question.. i am hoping that i can get solution from this good forum.
    how can i copy largefiles too (1Mb to 10Gb)
    i tried using this command "cp -r xxxxx-1.1.1.tar.gz" to some path , this path i am giving
    i did this all by programatically..
    but this program copying only small files like .xpm, .png, .txt, .c etc...
    when i am sending xxxxx-1.1.1.tar.gz of 1.2Mb size it saying like this and also not copying
    cp: cannot stat `xxxxx-1.1.1.tar.gz': No such file or directory
    how can i copy this type of large file tooo?

    can you please help me

    thank you in advance.

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    You could if you asked in Linux or Tech...

    Sure the file exists? -r is recursive, do a man cp

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    136
    Quote Originally Posted by zacs7 View Post
    You could if you asked in Linux or Tech...

    Sure the file exists? -r is recursive, do a man cp
    i tried this also...
    "cp " (with out -r)
    but it fails.
    same error was came..(cp: cannot stat `filename-1.1.1.tar.gz': No such file or directory)

    i would like to copy any file with any size...

    how can i do this..

    thank you in advance

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Post some actual code, like how you read the filename(s), open the files etc etc.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    It's size doesn't make any difference...

  6. #6
    Registered User
    Join Date
    Dec 2006
    Posts
    136
    Quote Originally Posted by zacs7 View Post
    It's size doesn't make any difference...

    now am using linux machine..
    i used "sip" here..
    i am sending files through sockets at other side the popup will be raised and having a save button if i click the save button it will save in perticular folder..... , here , i am using

    cp -i xxxxx-1.1.1.tar.gz /root/Desktop/123

    is it possible.
    yeah i did some extent.. upto save button clicked...
    here the error message is accuring in the terminal
    cp: cannot stat `xxxxx-1.1.1.tar.gz': No such file or directory

    i dont know why it is saying(terminal) like that..

    can you please help me

    thank you in advance

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    are you typing that into a shell or a different kind of program?

  8. #8
    Registered User
    Join Date
    Dec 2006
    Posts
    136
    Quote Originally Posted by robwhit View Post
    are you typing that into a shell or a different kind of program?
    i doing like this in gtk c.
    Code:
    char *s1;
    s1=g_strconcat("cp -i ",split1_filename11[1]," ", file,NULL);
       FILE* F;
       F=popen(s1,"r");
       pclose (F);
    "gchar **split1_filename11[1]" (file name)is a global declaration , it is getting from server.
    "file" is where to save.

    i used rcp also
    Code:
    char *s1;
    s1=g_strconcat("rcp -p ",split1_filename11[1]," ", file,NULL);
    all it saying
    cp: cannot stat `xxxxx-1.1.1.tar.gz': No such file or directory
    at file receiving side(at other machine)

    can you help me
    thank you in advance

  9. #9
    Day Dreamer
    Join Date
    Apr 2007
    Posts
    45
    for a different machine try using scp.

  10. #10
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    how do you assign gchar **split1_filename11[1]?

    g_strconcat returns gchar *.

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    The file size has nothing to do with being able to find it (or not).
    Since you seem to be using a remote machine, check what it considers to be the current directory.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  12. #12
    Registered User
    Join Date
    Dec 2006
    Posts
    136
    Quote Originally Posted by Salem View Post
    The file size has nothing to do with being able to find it (or not).
    Since you seem to be using a remote machine, check what it considers to be the current directory.
    the file size is ok..
    gchar **split1_filename11;
    let me clear my doubt.

    first am clicking send button, it will open file chooser..
    file choosing starts from working directory.
    i think here causing the problem.
    if i send a file from working directory , sucessfully sent to other machine. by using "cp -i" or "rcp -p".
    if i send a file from otherthan working directory..
    it showing the message and not sending my file to other machine.

    cp: cannot stat `filename': No such file or directory

    how can i do this..
    please help me

    thank you in advance

  13. #13
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well I guess your file chooser has some way of telling you which directory it was in when you picked the file.

    This isn't a C problem, it's simply a matter of RTFM to find out how the API you're using really works.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  14. #14
    Registered User
    Join Date
    Dec 2006
    Posts
    136
    Quote Originally Posted by Salem View Post
    Well I guess your file chooser has some way of telling you which directory it was in when you picked the file.
    yes am choosing the file when send button clicked in my machine ...to send.
    and choosing the file save button clicked in other machine..to save.
    i am running this exe. from source code path is
    /root/Desktop/123/src/run(run is my exe name)
    /root/Desktop/123/src/one.png this is the sending file..(one.png is the sending file)
    and at the receiving side /root/Desktop/6666... this is the saving path(6666 is the folder wr to save)
    like this it is sucessfully sending and receiving.

    and
    root/Desktop/two.png this is the sending file..(two.png is the sending file)
    and at the receiving side /root/Desktop/6666... this is the saving path(6666 is the folder wr to save)
    it is sending file but not receiving at the other machine...
    saying the same error.

    i think this is the only problem with file chooser..

    can you suggest me

    thank you in advance

  15. #15
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >root/Desktop/two.png this is the sending file..(two.png is the sending file)
    Have you tried /root/Desktop/two.png ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with recoding Tar command
    By +Azazel+ in forum C Programming
    Replies: 14
    Last Post: 12-02-2007, 01:46 PM
  2. Command Line arguments question
    By micpi in forum C Programming
    Replies: 7
    Last Post: 04-24-2007, 08:46 PM
  3. Ping problem
    By bladerunner627 in forum C++ Programming
    Replies: 12
    Last Post: 02-02-2005, 12:54 PM
  4. exe files in -c- language
    By enjoy in forum C Programming
    Replies: 6
    Last Post: 05-18-2004, 04:36 PM
  5. combining file contents with command line
    By pxleyes in forum C Programming
    Replies: 4
    Last Post: 04-12-2004, 10:27 PM