public class DLTest {
public static void main( String[] args ) {
try {
BufferedReader adUrlReader = new BufferedReader( new FileReader( "./AdUrls.csv" ) );
ArrayList adUrlList = new ArrayList();
String line;
while ( (line = adUrlReader.readLine()) != null ) {
adUrlList.add( line.trim() );
}
adUrlReader.close();
int fileCounter = 0;
for ( String adUrl : adUrlList ) {
try {
String cmdString = "/usr/bin/wget -v --output-document=/home/diggler/Desktop/groovy_testing/data_scrapes/Admonitor/DL/file" + Integer.to\
String(fileCounter) + " --tries=3 " + adUrl;
System.out.println( cmdString );
Runtime rt = Runtime.getRuntime();
Process p = rt.exec( cmdString );
p.waitFor();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String s;
while ((s = r.readLine())!=null) {
System.out.println( s );
}
r.close();
} catch ( IOException ioe ) { ioe.printStackTrace(); }
catch ( InterruptedException ie ) { ie.printStackTrace(); }
fileCounter++;
}
} catch ( IOException e ) { e.printStackTrace(); }
}
}
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。