Copy everything bar one folder

Mitch Contla mcontla at gmail.com
Tue Feb 27 22:17:47 UTC 2007


On 2/27/07, SteVe Cook <yorvik.ubunto at googlemail.com> wrote:
> I want to copy everything bar one very large folder from my current
> /home partition to another smaller partition and make this new partition
> /home.
>
> The only real problem I'm having is finding out how to copy all the
> files bar one. I could copy a few at a time I suppose but that seems
> rather long winded.
>
> Trawling round the web hasn't produced any answers.  Any body got any ideas
>
> SteVe
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>


Use find with -wholename and -prune options. Then pipe the output to xargs:

$ find /home  -wholename '/home/directory-not-to-copy' -prune -o
-print0 | xargs -I{} -0 mv {} /dest-folder/

You may want to tweak the mv options. man find and man mv for more information.

-- 
Mitch




More information about the ubuntu-users mailing list