K
k4
Witam
My class:
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class test {
public static void main( String [] args ) {
try{
Runtime runtime = Runtime . getRuntime();
String cmd ="/bin/cp /home/k/java/* /var/www/k/";
System.out.println(cmd);
Process process = runtime.exec(cmd);
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader bfr = new BufferedReader(isr);
String line;
while ( ( line = bfr . readLine() ) != null ) {
System.out.println(line);
}
}catch(Exception e){
}
}
}
If I use "*" to copy all files, then command doesn't work why? If I try
copy single file then everything is ok.
String cmd ="/bin/cp /home/k/java/single.txt /var/www/k/";
How to copy all files ? :/a
My class:
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
public class test {
public static void main( String [] args ) {
try{
Runtime runtime = Runtime . getRuntime();
String cmd ="/bin/cp /home/k/java/* /var/www/k/";
System.out.println(cmd);
Process process = runtime.exec(cmd);
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader bfr = new BufferedReader(isr);
String line;
while ( ( line = bfr . readLine() ) != null ) {
System.out.println(line);
}
}catch(Exception e){
}
}
}
If I use "*" to copy all files, then command doesn't work why? If I try
copy single file then everything is ok.
String cmd ="/bin/cp /home/k/java/single.txt /var/www/k/";
How to copy all files ? :/a