The ant task to get files from a webdav repository discards parts of files. This has something to do with the InputStream.available which might 0 whenever there's still data available in the stream so the remaining data is discarded. I created a fix by using WebdavResource, which works fine but, because I was in a hurry, it's a little dirty. Below you'll find the fix. private void getAndStoreResource(HttpURL url, File target)throws IOException,IOException,FileNotFoundException{ File directory = target.getParentFile(); if(!directory.exists()) directory.mkdirs(); url.setUserinfo(userid,password); WebdavResource webdavResource = Utils.getWebdavResource(url); log("Downloading '" +url.getURI()); if (webdavResource.getMethod(target)) { log("succeeded."); countWrittenFiles++; } else { log("failed."); log(webdavResource.getStatusMessage()); } webdavResource.close(); }