Hello,
I'm working with a package that uses download.file in functions to
extract information from remote databases. My current environment is
Windows XP Pro SP3, R 2.7. A full extraction can be a great deal of
data, so the download is accomplished in generally manageable packets,
such that a single download will result in many files, which are written
to a directory. It is not uncommon for a progressing download to fail
unexpectedly midstream (firewall issues, server crashes/reboots, etc).
When this occurs the last file remains attached (and empty), at least as
far is Windows is concerned. I need to delete it to properly resume
downloading. Windows won't let me do that unless I exit R, as it regards
the file as in use. And unlink won't do it, although it doesn't report
an error either. And if I try to unlink the folder containing the
problem file, it deletes all files in the folder except the attached
one, does not delete the folder, and again no message to indicate any
problem. Any way to release the file without exiting and restarting R?
> showConnections(all=TRUE)
description class mode text isopen can read can write
0 "stdin" "terminal" "r" "text"
"opened" "yes" "no"
1 "stdout" "terminal" "w" "text"
"opened" "no" "yes"
2 "stderr" "terminal" "w" "text"
"opened" "no" "yes"
>
unlink("D:\\sharks\\KalmanFilter\\F34520\\AG2008072_2008074_sst.xyz")
#does nothing, no message (status 0)
> unlink("D:\\sharks\\KalmanFilter\\F34520",recursive=TRUE)
#does not delete the folder, deletes any files in the folder EXCEPT the
attached one, no message (status 0)
> Mark Fowler
Population Ecology Division> Bedford Inst of Oceanography
> Dept Fisheries & Oceans
> Dartmouth NS Canada
B2Y 4A2
Tel. (902) 426-3529
Fax (902) 426-9710
Email fowlerm@mar.dfo-mpo.gc.ca
Home Tel. (902) 461-0708
Home Email mark.fowler@ns.sympatico.ca
[[alternative HTML version deleted]]