如何按文件类型递归地查找文件,并同时将其复制到目录中的SSH? [英] How to find files recursively by file type and copy them to a directory while in ssh?

查看:257
本文介绍了如何按文件类型递归地查找文件,并同时将其复制到目录中的SSH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到所有的PDF文件的文件夹中,该文件夹具有里面的PDF文件和多个目录中有PDF文件以及。该文件夹位于远程服务器,我有SSH访问。我使用的是MAC终端,但我相信我的服务器我连接是Centos的。

I would like to find all the pdfs in a folder, this folder has pdfs inside it and more directories that have pdfs 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.

我需要找到所有的PDF文件,并​​将它们全部复制到一个目录在远程服务器上。我试过,没有运气约10种。这两个煤矿和远程系统似乎并不承认-exec作为命令虽然EXEC是罚款那么这就是一个问题。

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, whenever a command i've tried doesnt fail it just sits there and stalls forever so i dont 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.

推荐答案

试试这个:

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

这篇关于如何按文件类型递归地查找文件,并同时将其复制到目录中的SSH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆