Find the answer to your Linux question:
Results 1 to 2 of 2
Hello all, I have a directory on a text only machine that is 17GB that I have to transfer over to another machine. Unfortunately all I have to do it ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    4

    Copy recursively, omit one subdirectory

    Hello all, I have a directory on a text only machine that is 17GB that I have to transfer over to another machine. Unfortunately all I have to do it with is a 2GB flash drive. There's one subdirectory inside this directory that is 16GB, so if I could copy all the files/directories except this one it'd make it a lot easier(I could then go through and get only what I needed from it.

    So if I've got a directory named "top" and it has ~100 files and ~20 sub directories, one of named "data" that is 16GB. How would I go about copying everything but "data"?

    Kind of like this:
    Code:
    cp -r top -omit /data /mnt/usb/destination
    if that makes any sense.
    Thanks!

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Use tar instead of cp because it has the --exclude option.

    Code:
    tar -cvf - --exclude top/data top | (cd /mnt/usb/destination; tar -xvf -)

Posting Permissions

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