Find the answer to your Linux question:
Results 1 to 2 of 2
I'm trying to copy the contents of a directory and all it's sub folders into another directory (same sub folder structure). However if I du -h the original folder the ...
  1. #1
    Just Joined!
    Join Date
    May 2007
    Posts
    4

    cp seems to miss out some files

    I'm trying to copy the contents of a directory and all it's sub folders into another directory (same sub folder structure).

    However if I du -h the original folder the size is 212Mb after copying (with recursive option, -r) performing a du -h on the new folder gives 191Mb.

    My question is why are the sizes of the two folders different? Does it mean some of the files haven't copied over? I can't see any missing.

    Thanks.

  2. #2
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    Perhaps some hidden files are left? cp oldpath/* newpath does not copy hidden files.

    Try this:
    Code:
     ls -aR oldpath newpath | sort | uniq -u

Posting Permissions

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