I am downloading say 100 files from ucsc website and storing it into dest
folder.
download.file function create a file in destination folder even if the file
is not present which is something I dont want.
So I wrote if condition to remove the file if the download function has non
zero value.

Now it exits when there is an error or file not present. How can I use
"try" and "if" condition together so that the program does not exit on
error and delete the created file in destination folder.

for (i in 1: 100)
{
fileUrl = ucscfilenames[i]
if (download.file(fileUrl, destFile, 'wget' , quiet = TRUE) != 0)
    {
    file.remove(destFile)
    }
}



thanks

-- 
-------------
Mary Kindall
Yorktown Heights, NY
USA

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to