I am trying to write a script (preferably in bash) to flatten a java projet directory structure prepending the path to the file. Example:
| src
| org
| apache
| file2.java
| file1.java
would result in:
| src
| org|apache|file2.java
| org|file1.java
The script should be recursive since开发者_开发问答 the directory could have many subfolders.
cd src
for i in $(find . - name '*.java') ; do
echo cp \"$i\" $(echo "$i" | tr / _)
done
if it looks good(might barf if filenames contains spaces), pipe the result to sh
精彩评论