Page 1 of 2 12 LastLast
Results 1 to 10 of 35

Thread: cp only copies directories and not files

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Location
    /home
    Beans
    66

    cp only copies directories and not files

    I am trying to copy the files from my WHS disk to my Ubuntu Server disk. I have the windows disk mounted at /media/WINDOWS and I want to transfer to /storage so I ran;

    Code:
    sudo cp -r /media/WINDOWS /storage
    It takes about 4-5 seconds and is complete, but there is about 500 GB worth of data there so I know it didn't really copy everything over. When I look at the files in console it shows them, but when I look at the /storage through SAMBA on my Windows machine, it only shows the directories. Am I doing something wrong with the 'cp' command? Is there a better way to do this?

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    12,981
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: cp only copies directories and not files

    Quote Originally Posted by GriFF3n View Post
    Is there a better way to do this?
    Use rsync. ('sudo apt-get install rsync' if it isn't already there.).

    rsync -av /path/to/directory /target

    will copy everything in the source to the target. Next time you run this it will copy only those files that have changed since the last snapshot.

  3. #3
    Join Date
    Apr 2008
    Location
    /home
    Beans
    66

    Re: cp only copies directories and not files

    Quote Originally Posted by SeijiSensei View Post
    Use rsync. ('sudo apt-get install rsync' if it isn't already there.).

    rsync -av /path/to/directory /target

    will copy everything in the source to the target. Next time you run this it will copy only those files that have changed since the last snapshot.

    Yea thats what I was thinking of doing. It just throws me off that 'cp' only copied directories and not files.

  4. #4
    Join Date
    Apr 2008
    Location
    /home
    Beans
    66

    Re: cp only copies directories and not files

    rsync does the same thing, makes directories but doesn't copy files. Used the same syntacs as described and no go.

    I get;

    Code:
    unsupported reparse point
    for all the files.

  5. #5
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: cp only copies directories and not files

    Try this:

    Code:
    sudo rsync -ai /media/WINDOWS/* /storage/
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  6. #6
    Join Date
    Apr 2008
    Location
    /home
    Beans
    66

    Re: cp only copies directories and not files

    Quote Originally Posted by CharlesA View Post
    Try this:

    Code:
    sudo rsync -ai /media/WINDOWS/* /storage/

    Thanks for the idea but still no go. Maybe it has something to do with file permissions? Not really sure but this is a pretty big problem considering the main objective of this server is a fileserver.

  7. #7
    Join Date
    Nov 2006
    Location
    Chicago burbs
    Beans
    75
    Distro
    Ubuntu

    Re: cp only copies directories and not files

    Quote Originally Posted by GriFF3n View Post
    I am trying to copy the files from my WHS disk to my Ubuntu Server disk. I have the windows disk mounted at /media/WINDOWS and I want to transfer to /storage so I ran;

    Code:
    sudo cp -r /media/WINDOWS /storage
    It takes about 4-5 seconds and is complete, but there is about 500 GB worth of data there so I know it didn't really copy everything over. When I look at the files in console it shows them, but when I look at the /storage through SAMBA on my Windows machine, it only shows the directories. Am I doing something wrong with the 'cp' command? Is there a better way to do this?
    I went back to your original post, because I have a question about how you are verifying that it is not copying files.

    From a terminal session on the server, if you do:

    find /storage -type f

    ...nothing shows up?

    Let's make sure it's not a Windows or Samba issue...

    -Bill

  8. #8
    Join Date
    Apr 2008
    Location
    /home
    Beans
    66

    Re: cp only copies directories and not files

    Quote Originally Posted by the_original_billq View Post
    From a terminal session on the server, if you do:

    Code:
    find /storage -type f
    -Bill
    I get nothing. I sftp into my box from work using FileZilla. I connect and can navigate my files. I can go into the files I've "copied", but cannot access them. I see the files and their types, but they are not showing the true size or anything. If I do a 'file' on any of the files in these directories, I get a "unsupported reparse point'

  9. #9
    Join Date
    Nov 2006
    Location
    Chicago burbs
    Beans
    75
    Distro
    Ubuntu

    Re: cp only copies directories and not files

    Let's understand this a bit better.

    Can you create a simple text file in /storage?

    Try doing something very simple, like

    cp /etc/profile /storage/foo

    cat /storage/foo

    If that doesn't work, I would ask... Is /storage local, or a Samba-mounted filesystem?

  10. #10
    psusi is offline Ubuntu addict and loving it
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Beans
    3,980
    Distro
    Ubuntu Development Release

    Re: cp only copies directories and not files

    Is /storage an NTFS partition? It sounds like it is and that it's messed up. Don't use NTFS on a linux server.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •