Open bquistorff opened 2 years ago
I totally agree! If "someone" kindly writes a programs that takes a directory name and removes it - for all operating systems - i gladly merge it. It is very annoying to have the unzipped directory remaining... I'm just heavily overwhelmed at the moment to develop and test such a program, no matter how simple it seems to be... please feel free to take the lead
Some random code I had lying around. Would need to be test.
mata
/*
*@brief Recursively removes folder with files it in it
*@param path Directory path to remove
*/
real scalar function rmdir_complete(string scalar path)
{
if (!regexm(path,"[/\]$")) path = path+"/"
// display("{hline}{break}Entering folder "+path)
string colvector dirs, files
dirs = dir(path,"dirs","*",1)
files = dir(path,"files","*",1)
real scalar i
for(i=1;i<=length(dirs);i++){
rmdir_complete(dirs[i])
}
for(i=1;i<=length(files);i++){
unlink(files[i])
}
rmdir(path)
}
end
Using
github
to install a particular version of a package, e.g.rcall
, (on Windows, Stata 15) leaves behind anrcall-X.X.X
folder extracted from thezip
file. It would be good to have an option to delete this after installation, especially as this folder has the dynamic element of the version (e.g. "stable" -> "3.0.7"). If I'm usinggithub
in a script, it would be hard for the script to know the version always and delete the folder programmatically. It might even be good to have this option by default.