7 replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
source | link

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

CAVEAT: I'm using a recursive glob here; this is the globstar option in Bash 4+ and ksh, and is supported by default in zsh. Recursive globs do not match hidden files and folders, and the some implementations follow symlinks while others do notsome implementations follow symlinks while others do not.

If your shell doesn't support recursive globs, or if you'd prefer not to use them, you can do the following:

  • *.csv */*.csv */*/*.csv */*/*/*.csv -- this is of course very redundant and requires knowing how deep your directory structure is.
  • $(find . -name '*.csv') -- This will match hidden files and folders. find also supports specifying whether or not symlinks are followed, which may be useful.

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

CAVEAT: I'm using a recursive glob here; this is the globstar option in Bash 4+ and ksh, and is supported by default in zsh. Recursive globs do not match hidden files and folders, and the some implementations follow symlinks while others do not.

If your shell doesn't support recursive globs, or if you'd prefer not to use them, you can do the following:

  • *.csv */*.csv */*/*.csv */*/*/*.csv -- this is of course very redundant and requires knowing how deep your directory structure is.
  • $(find . -name '*.csv') -- This will match hidden files and folders. find also supports specifying whether or not symlinks are followed, which may be useful.

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

CAVEAT: I'm using a recursive glob here; this is the globstar option in Bash 4+ and ksh, and is supported by default in zsh. Recursive globs do not match hidden files and folders, and the some implementations follow symlinks while others do not.

If your shell doesn't support recursive globs, or if you'd prefer not to use them, you can do the following:

  • *.csv */*.csv */*/*.csv */*/*/*.csv -- this is of course very redundant and requires knowing how deep your directory structure is.
  • $(find . -name '*.csv') -- This will match hidden files and folders. find also supports specifying whether or not symlinks are followed, which may be useful.
6 deleted 130 characters in body
source | link

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

(Note thatCAVEAT: I'm using a recursive glob here; if you don't have that feature in your shell, use *.csv */*.csv */*/*.csv */*/*/*.csv orthis is the $(find . -name '*.csv')globstar. option in Bash 4+ and ksh support it, but it's offand is supported by default; I thinkdefault in zsh has it on by default.)

EDIT: Fixed Recursive globs find command. Haven't used it in a whiledo not match hidden files and I hate that toolfolders, so of course I messed it up onand the first trysome implementations follow symlinks while others do not.

If your shell doesn't support recursive globs, or if you'd prefer not to use them, you can do the following:

  • *.csv */*.csv */*/*.csv */*/*/*.csv -- this is of course very redundant and requires knowing how deep your directory structure is.
  • $(find . -name '*.csv') -- This will match hidden files and folders. find also supports specifying whether or not symlinks are followed, which may be useful.

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

(Note that I'm using a recursive glob here; if you don't have that feature in your shell, use *.csv */*.csv */*/*.csv */*/*/*.csv or $(find . -name '*.csv'). Bash 4+ and ksh support it, but it's off by default; I think zsh has it on by default.)

EDIT: Fixed find command. Haven't used it in a while and I hate that tool, so of course I messed it up on the first try.

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

CAVEAT: I'm using a recursive glob here; this is the globstar option in Bash 4+ and ksh, and is supported by default in zsh. Recursive globs do not match hidden files and folders, and the some implementations follow symlinks while others do not.

If your shell doesn't support recursive globs, or if you'd prefer not to use them, you can do the following:

  • *.csv */*.csv */*/*.csv */*/*/*.csv -- this is of course very redundant and requires knowing how deep your directory structure is.
  • $(find . -name '*.csv') -- This will match hidden files and folders. find also supports specifying whether or not symlinks are followed, which may be useful.
5 added 91 characters in body
source | link

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

(Note that I'm using a recursive glob here; if you don't have that feature in your shell, use *.csv */*.csv */*/*.csv */*/*/*.csv or $(find . -name '*.csv'). Bash 4+ and ksh support it, but it's off by default; I think zsh has it on by default.)

EDIT: Fixed find command. Haven't used it in a while and I hate that tool, so of course I messed it up on the first try.

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

(Note that I'm using a recursive glob here; if you don't have that feature in your shell, use *.csv */*.csv */*/*.csv */*/*/*.csv or $(find . -name '*.csv').)

EDIT: Fixed find command. Haven't used it in a while and I hate that tool, so of course I messed it up on the first try.

The cp command permits multiple source arguments:

cp **/*.csv --parents ../target

(Note that I'm using a recursive glob here; if you don't have that feature in your shell, use *.csv */*.csv */*/*.csv */*/*/*.csv or $(find . -name '*.csv'). Bash 4+ and ksh support it, but it's off by default; I think zsh has it on by default.)

EDIT: Fixed find command. Haven't used it in a while and I hate that tool, so of course I messed it up on the first try.

4 added 5 characters in body
source | link
3 typo on --parents
source | link
2 added 129 characters in body
source | link
1
source | link