Skip to main content
edited tags
Link
Jeff Schaller
  • 68.9k
  • 35
  • 122
  • 268
deleted 4 characters in body
Source Link
Loom
  • 4.1k
  • 11
  • 33
  • 44

I have a directory with ~100 Gb. I need to copy this directory to other place skipping specific folders (there is a lot of such directoriesthem). The following is a wrong code to demonstrate my needs.

$ cp -r ~/directory_to_copy /path/to/copy --skip=foo --skip=bar 

There is an example of result this command. Original directory tree is

~/directory_to_copy aaa foo doo bar bbb ccc ddd bar eee 

Copied tree is

/path/to/copy/ aaa doo bbb ccc ddd eee 

How to write command for my purposes?

I have a directory with ~100 Gb. I need to copy this directory to other place skipping specific (there is a lot of such directories). The following is a wrong code to demonstrate my needs.

$ cp -r ~/directory_to_copy /path/to/copy --skip=foo --skip=bar 

There is an example of result this command. Original directory tree is

~/directory_to_copy aaa foo doo bar bbb ccc ddd bar eee 

Copied tree is

/path/to/copy/ aaa doo bbb ccc ddd eee 

How to write command for my purposes?

I have a directory with ~100 Gb. I need to copy this directory to other place skipping specific folders (there is a lot of them). The following is a wrong code to demonstrate my needs.

$ cp -r ~/directory_to_copy /path/to/copy --skip=foo --skip=bar 

There is an example of result this command. Original directory tree is

~/directory_to_copy aaa foo doo bar bbb ccc ddd bar eee 

Copied tree is

/path/to/copy/ aaa doo bbb ccc ddd eee 

How to write command for my purposes?

Source Link
Loom
  • 4.1k
  • 11
  • 33
  • 44

copy recursively skipping directories with specific name

I have a directory with ~100 Gb. I need to copy this directory to other place skipping specific (there is a lot of such directories). The following is a wrong code to demonstrate my needs.

$ cp -r ~/directory_to_copy /path/to/copy --skip=foo --skip=bar 

There is an example of result this command. Original directory tree is

~/directory_to_copy aaa foo doo bar bbb ccc ddd bar eee 

Copied tree is

/path/to/copy/ aaa doo bbb ccc ddd eee 

How to write command for my purposes?