How to copy "just files" recursively

SirSaleh

Suppose I have this structure for folder0 and subfolders and files in it.

   folder0
      subfolder01
        file011
        file012
      subfolder02
        file021
      file01
      file02

I want to copy all files in main folder folder0 to somewhere else, such that all file be in one directory? How Can I do that? I used

cp --recursive folder0address targetfolderaddress

But subfolders copied to target folder. I just want all files in directory and sub directories not folders. I mean something like the below in target folder:

targetfolder
  file011
  file012
  file021
  file01
  file02
Satō Katsura

Use find:

find folder0 -type f -exec cp {} targetfolder \;

With GNU coreutils you can do it more efficiently:

find folder0 -type f -exec cp -t targetfolder {} +

The former version runs cp for each file copied, while the latter runs cp only once.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to recursively copy in place a FormGroup?

From Dev

How to copy a subset of subfolders recursively

From Java

How do I copy directories recursively with gulp?

From Dev

How to recursively copy file an folder in .Net?

From Dev

How to copy recursively and change file names to be unique

From Dev

How can I recursively copy files without overwriting existing permissions?

From Dev

How do I recursively copy/download a whole webdav directory?

From Dev

how to include and copy files that are in current directory to s3 (and not recursively)

From Dev

How do I copy all files recursively to a flat directory in Ruby?

From Dev

How to copy contents of a directory recursively without maintaining the directory hierarchy?

From Dev

How to copy all files by specified extension to another location recursively

From Dev

How do I recursively copy/download a whole webdav directory?

From Dev

How can I recursively copy files without overwriting existing permissions?

From Dev

How to copy a folder recursively in an idempotent way using cp?

From Dev

How to recursively copy only the files from folders and subfolders?

From Dev

How to copy recursively all files not older than 1 day?

From Dev

How can I copy a hidden directory recursively and preserving its permissions?

From Dev

How to recursively copy files using Windows command line

From Dev

How to recursively copy files as hard links into directory preserving directory hierarchy?

From Dev

How can I recursively copy files by file extension?

From Dev

How to copy all files in directory recursively and unzip compressed files on fly

From Dev

How can I use a wildcard to match just files, not directories?

From Dev

How to search for text within compressed files and get just the files name

From Dev

Linux Copy recursively

From Dev

Copy and overwrite directory recursively

From Dev

Python: copy folder content recursively

From Dev

Python: copy folder content recursively

From Dev

copy recursively except hidden directory

From Dev

How can I copy associative array items to another single array item recursively?

Related Related

  1. 1

    How to recursively copy in place a FormGroup?

  2. 2

    How to copy a subset of subfolders recursively

  3. 3

    How do I copy directories recursively with gulp?

  4. 4

    How to recursively copy file an folder in .Net?

  5. 5

    How to copy recursively and change file names to be unique

  6. 6

    How can I recursively copy files without overwriting existing permissions?

  7. 7

    How do I recursively copy/download a whole webdav directory?

  8. 8

    how to include and copy files that are in current directory to s3 (and not recursively)

  9. 9

    How do I copy all files recursively to a flat directory in Ruby?

  10. 10

    How to copy contents of a directory recursively without maintaining the directory hierarchy?

  11. 11

    How to copy all files by specified extension to another location recursively

  12. 12

    How do I recursively copy/download a whole webdav directory?

  13. 13

    How can I recursively copy files without overwriting existing permissions?

  14. 14

    How to copy a folder recursively in an idempotent way using cp?

  15. 15

    How to recursively copy only the files from folders and subfolders?

  16. 16

    How to copy recursively all files not older than 1 day?

  17. 17

    How can I copy a hidden directory recursively and preserving its permissions?

  18. 18

    How to recursively copy files using Windows command line

  19. 19

    How to recursively copy files as hard links into directory preserving directory hierarchy?

  20. 20

    How can I recursively copy files by file extension?

  21. 21

    How to copy all files in directory recursively and unzip compressed files on fly

  22. 22

    How can I use a wildcard to match just files, not directories?

  23. 23

    How to search for text within compressed files and get just the files name

  24. 24

    Linux Copy recursively

  25. 25

    Copy and overwrite directory recursively

  26. 26

    Python: copy folder content recursively

  27. 27

    Python: copy folder content recursively

  28. 28

    copy recursively except hidden directory

  29. 29

    How can I copy associative array items to another single array item recursively?

HotTag

Archive