Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试编写一个脚本(最好在 bash 中)来展平一个 java projet 目录结构,并在文件的路径之前。例子:
| src | org | apache | file2.java | file1.java
会导致:
| src | org|apache|file2.java | org|file1.java
该脚本应该是递归的,因为该目录可能有许多子文件夹。
cd src for i in $(find . - name '*.java') ; do echo cp \"$i\" $(echo "$i" | tr / _) done
如果它看起来不错(如果文件名包含空格可能会出错),将结果传递给sh
sh