Skip to main content
rsync has no capital R, code format
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

Rsyncrsync is a good solution, but if you're looking for an alternative:

Let's say, we have a directory "test" contain the directories "foo, bar, baz". In these dirs are a bunch of different file types:

test |____bar | |____1.jpg | |____1.png | |____1.txt | |____2.jpg | |____2.png | |____2.txt |____baz | |____1.avi | |____2.avi | |____3.png |____foo | |____test.blah |____test.txt 

We want to copy everything except the PNGs

scp $(find /location/of/test -type f ! -name "*.png") # -> Note the logical NOT!! 

In this example, the command will put all of the files into the same destination directory - this may not be the behavior you want.

Rsync is a good solution, but if you're looking for an alternative:

Let's say, we have a directory "test" contain the directories "foo, bar, baz". In these dirs are a bunch of different file types:

test |____bar | |____1.jpg | |____1.png | |____1.txt | |____2.jpg | |____2.png | |____2.txt |____baz | |____1.avi | |____2.avi | |____3.png |____foo | |____test.blah |____test.txt 

We want to copy everything except the PNGs

scp $(find /location/of/test -type f ! -name "*.png") # -> Note the logical NOT!! 

In this example, the command will put all of the files into the same destination directory - this may not be the behavior you want.

rsync is a good solution, but if you're looking for an alternative:

Let's say, we have a directory "test" contain the directories "foo, bar, baz". In these dirs are a bunch of different file types:

test |____bar | |____1.jpg | |____1.png | |____1.txt | |____2.jpg | |____2.png | |____2.txt |____baz | |____1.avi | |____2.avi | |____3.png |____foo | |____test.blah |____test.txt 

We want to copy everything except the PNGs

scp $(find /location/of/test -type f ! -name "*.png") # -> Note the logical NOT!! 

In this example, the command will put all of the files into the same destination directory - this may not be the behavior you want.

Post Migrated Here from stackoverflow.com (revisions)
Source Link
simonm
simonm

Rsync is a good solution, but if you're looking for an alternative:

Let's say, we have a directory "test" contain the directories "foo, bar, baz". In these dirs are a bunch of different file types:

test |____bar | |____1.jpg | |____1.png | |____1.txt | |____2.jpg | |____2.png | |____2.txt |____baz | |____1.avi | |____2.avi | |____3.png |____foo | |____test.blah |____test.txt 

We want to copy everything except the PNGs

scp $(find /location/of/test -type f ! -name "*.png") # -> Note the logical NOT!! 

In this example, the command will put all of the files into the same destination directory - this may not be the behavior you want.