On Feb 26, 2007, at 2:33 PM, Tim Jones wrote: > On Feb 26, 2007, at 12:25 PM, Charles Yeomans wrote: > >> On Feb 26, 2007, at 2:11 PM, Tim Jones wrote: >> >>> Here's a sure way (warning to shell haters - involves shell and >>> sudo...) >>> >>> Prompt user for admin password: >>> >>> Dim sh As New Shell >>> >>> Sh.Execute "echo " + thePassword + " | sudo -S /usr/bin/true" >>> Sh.execute "sudo rm -rf " + f.ShellPath >>> Sh.Execute "sudo -K" >>> >>> This would use your same f folderitem. By doing the first sudo >>> call, >>> the potential for someone ca[turing the password is reduced to near >>> nil. The last sudo -K just resets / clears the sudo timer. >> >> I don't think this is necessarily more sure. How does it handle a >> change of directory contents during execution? > > The Shell's rm command locks the specified path while the rm occurs. > Also, because the rm uses the system rmdir or unlink call (man 2 > unlink, man 2 rmdir), the deletion event is atomic, so external > opportunity for adding to the folder as it's being removed are > prevented.
Well, this does seem better. ------------------------ Charles Yeomans http://www.declareSub.com/ _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
