5

macOS下拷贝目录的小事

 1 year ago
source link: http://xfyuan.github.io/2022/11/copy-foler-structure-without-contents/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

macOS下拷贝目录的小事

Mr.Z
Written by Mr.Z on 24 Nov 2022
macOS下拷贝目录的小事

最近在 macOS 上碰到一个小问题,需要把原来一个很大的目录拷贝到另一个位置,要求必须保持其内部所有的子目录结构,但不需要拷贝每个目录下的任何文件,因为到时会有新的文件放到各个目录下。

这里比较棘手的地方在于,原来那个目录下有非常多的子目录和嵌套(至少有上百个以上,而且嵌套层数没有规律),这样的话要是靠手工去一个个复制粘贴,那得累死个人了。😭

以前还真没处理过类似问题,于是花了10分钟搜了一下,最后在 Apple 社区找到了,确实有人早就碰到类似的需求。直接看怎么解决的吧:

# 进入要复制的目录
cd /path/to/beginning/dir
# 查找所有 dictionary,并在目标目录创建相同名称的子目录
find . -type d -print0 | xargs -0 -I{} mkdir -p "/path/to/DestinationFoler/{}"
Mr.Z
About Mr.Z A Chinese software engineer living and working in Chengdu. I love Creating the future in digital worlds, big and small.

Share

Explore more like this

Rails7 的Zeitwerk模式解惑

本文已获得原作者(Athira Kadampatta、Supriya Laxman Medankar)和 Kiprosh 授权许可进行翻译。原文详细讲述了 Rails 7 中新的 Zeitwerk 自动加载模式。

Mr.ZMr.Z 21 Nov 2022

纯粹的Rails便已足够

本文已获得原作者(Jorge Manrubia)和 37signals 授权许可进行翻译。原文讲述了在 37signals 公司中如何使用纯粹 Rails应用架构方案,及其怎样在另一个层面对 DDD(领域驱动设计) 原则做出最佳体现的故事。

Mr.ZMr.Z 17 Nov 2022

野生的ViewComponent(下): 为组件增压加速

本文已获得原作者(Alexander Baygeldin、Travis Turner)和 Evil Martians 授权许可进行翻译。原文讲述了在单体式模块架构下,使用 ViewComponent 来构建组件化的现代 Rails 前端的故事。(本文是下篇)

Mr.ZMr.Z 11 Nov 2022

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK