3
cp -v -ur path/to/jsps/ /dest/path/

上述命令将所有已更新的文件从源目录复制到目标,保留目录结构。

我不知道如何只复制 *.someExtention 文件。我知道你可以使用类似的东西:

find -f -name *.jsp -exec some awesome commands {}

但我不知道该怎么做(而且我没有时间详细阅读信息页面)。

非常感谢所有帮助。

谢谢, LES

4

2 回答 2

7

如果您想使用 find / cp 那么以下应该可以解决问题:

find -f -name *.jsp -exec cp --parents {} /dest/path \;

但 rsync 可能是更好的工具。

于 2009-03-16T16:34:46.420 回答
4

rsync可能会有所帮助-您可以告诉它仅使用包含和排除选项的组合复制某些文件,例如

rsync -a \
   --include='*.foo' \
   --include='*/' \
   --exclude='*' \
   path/to/jsps/ /dest/path/

请参阅手册并查看标题为 FILTER RULES 的部分以了解更多信息。

于 2009-03-16T16:31:29.580 回答