开发者

Move all files of same type in multiple directories up one folder

I have about 2000 subfolders in one folder, in each of these folders there are .pdf开发者_如何学C files. I need a unix command that will move all these files up one folder.


$ cd thefolder # which contains the subfolders and where the PDFs should land
$ find . -name *.pdf | xargs -I {} cp -iv {} .

# find all files
# which end in .pdf
# recursively from
# the current folder
#                    |
#                      for each emitted line
#                      copy the output (captured by {}) to 
#                      the specified path ('.' is the current directory)
#                      copy should be verbose and should ask,
#                      in case a file would be overwritten

This should copy your files into /thefolder/. If you want to move them replace cp with mv.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜