In my project, i need to segregate all .java files in a folder and paste it in a separate folder. I figured out that the below mentioned command works for this purpose
for /f "delims==" %k in ('dir C:\Project\downloads\*.java /s /b') do copy "%k" C:\Project\javaRepo
In the above command, the Source Folder : C:\Project\downloads\
Destination folder to copy all .java files : C:\Project\javaRepo
I tried using the following command in JAVA,
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(.....);
But I am not clear how to put the "for" command as an argument for rt.exec.
I tried creating a batch file as follows, but it doesn't work.
@echo off
for /f "delims==" %k in ('dir C:\Project\downloads\*.java /s /b') do copy "%k" C:\Project\javaRepo
Can you let me know if my approach is correct, or is there any other better alternative? Suggestions / ideas are most welcome.