How to find files recursively by file type and copy them to a directory while in ssh?

lorless

I would like to find all the pdf files in a folder. It contains pdf files inside and more directories that contain more as well. The folder is located on a remote server I have ssh access to. I am using the mac terminal but I believe the server I am connecting to is Centos.

I need to find all the pdfs and copy them all to one directory on the remote server. I've tried about 10 variations with no luck. Both mine and the remote systems do not seem to recognise -exec as a command though exec is fine so thats a problem.

Im not sure what the problem is here but the command does not fail it just sits there and stalls forever so I do not have any useful errors to post.

cp $(find -name "*.pdf" -type f; exec ./pdfsfolder {} \; | sed 1q)

find: ./tcs/u25: Permission denied
find: ./tcs/u68: Permission denied
-bash: /var/www/html/tcs_dev/sites/default/files/pdfsfolder: is a directory
-bash: exec: /var/www/html/tcs_dev/sites/default/files/pdfsfolder: cannot execute: Success
cp: target `./runaways_parents_guide_2013_final.pdf' is not a directory

This is the last one I tried, I think I can ignore the permission denied errors for now but im not sure about the rest.

Paul Dardeau

Try this:

find . -name "*.pdf" -type f -exec cp {} ./pdfsfolder \;

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 list all files of desired file type in a specified directory?

From Dev

Search a directory recursively for files listed in a csv, and copy them to another location

From Dev

Find document files and copy them to another directory

From Dev

find modified files recursively and copy with directory preserving directory structure

From Dev

Find all files from today recursively and copy them

From Dev

Find all files, and copy them to a folder (Flatten recursively)

From Dev

Find all files, and copy them to a folder (Flatten recursively)

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, preserving directory structure?

From Dev

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

From Dev

How do I copy files recursively through a directory tree while appending parent folder names to the new files? Batch or VBScript

From Dev

How do I copy files recursively through a directory tree while appending parent folder names to the new files? Batch or VBScript

From Dev

How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

From Dev

How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

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

Recursively "find" file names containing string and symlink files in another directory

From Dev

How to get Bower Install to copy files to another directory before linking them in html file?

From Dev

Recursively find the number of files in a directory

From Dev

Recursively find the number of files in a directory

From Dev

How to copy a directory with only specified type of files?

From Dev

How to find all files that contain the + sign on a directory recursively?

From Dev

How to execute recursively a program on every files contained in directory with find

From Dev

How to recursively traverse a directory tree and find only files?

From Dev

'find' all .log files under a directory, copy them to another directory named after their parent directory?

From Dev

How to find all files of type and move them to a {another_dir}/{dir_files_are_at}/{file}?

From Dev

Copy files recursively with grunt-ssh

From Dev

How can I recursively copy files by file extension?

From Dev

Recursively copy files from one directory to another

Related Related

  1. 1

    How to recursively list all files of desired file type in a specified directory?

  2. 2

    Search a directory recursively for files listed in a csv, and copy them to another location

  3. 3

    Find document files and copy them to another directory

  4. 4

    find modified files recursively and copy with directory preserving directory structure

  5. 5

    Find all files from today recursively and copy them

  6. 6

    Find all files, and copy them to a folder (Flatten recursively)

  7. 7

    Find all files, and copy them to a folder (Flatten recursively)

  8. 8

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

  9. 9

    How can I recursively copy files by file extension, preserving directory structure?

  10. 10

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

  11. 11

    How do I copy files recursively through a directory tree while appending parent folder names to the new files? Batch or VBScript

  12. 12

    How do I copy files recursively through a directory tree while appending parent folder names to the new files? Batch or VBScript

  13. 13

    How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

  14. 14

    How can I recursively find a directory by name and delete its contents (including all sub-directories and files) while keeping the directory itself?

  15. 15

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

  16. 16

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

  17. 17

    Recursively "find" file names containing string and symlink files in another directory

  18. 18

    How to get Bower Install to copy files to another directory before linking them in html file?

  19. 19

    Recursively find the number of files in a directory

  20. 20

    Recursively find the number of files in a directory

  21. 21

    How to copy a directory with only specified type of files?

  22. 22

    How to find all files that contain the + sign on a directory recursively?

  23. 23

    How to execute recursively a program on every files contained in directory with find

  24. 24

    How to recursively traverse a directory tree and find only files?

  25. 25

    'find' all .log files under a directory, copy them to another directory named after their parent directory?

  26. 26

    How to find all files of type and move them to a {another_dir}/{dir_files_are_at}/{file}?

  27. 27

    Copy files recursively with grunt-ssh

  28. 28

    How can I recursively copy files by file extension?

  29. 29

    Recursively copy files from one directory to another

HotTag

Archive