【发布时间】:2015-02-13 18:42:53
【问题描述】:
我将一个 html 文档从 Windows 机器拉到我的 linux 机器上,问题是两者之间没有维护目录结构。这就是它在linux中的样子
MyReport\partition_and_timing.files\img0.jpg
MyReport\partition_and_timing.html
MyReport\protocols_cards.html
MyReport\report_title.files\img0.jpg
MyReport\report_title.html
MyReport\scripts.html
我正在考虑使用 bash 脚本,将“\”更改为“/”,本质上是创建一个文件夹。我猜他们是这样做的标准方式,但无法弄清楚。
这就是我的工作
for file in *; do mv $file echo $file | sed 's/\\/\//g' ; done
【问题讨论】:
-
使用cygwin,实际上可以只使用正斜杠。系统知道会为您转换它们。
-
因为这是一个 HTML 文档,它们应该是正斜杠,即使在 Windows 中也是如此。浏览器将为您将它们转换为反斜杠。
标签: linux windows bash shell unix