Copy all java files to specified folder
问题 I have a input path src and output path dest . src can have multiple sub-directories, which can again have further sub-directories and so on. I want to copy all java files (and directories that contain them) from src to dest "as-is". That is, if src was: src - f1.java f4.txt dir_1 - f2.java dir_2 - f3.java dir_3 - f5.txt dest should look like: dest - f1.java dir_1 - f2.java dir_2 - f3.java I tried: cp src/*.java dest But it only copies f1.java , and nothing else. Can someone please help me