{"action":"created","issue":{"url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/106","labels_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/106/comments","events_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/106/events","html_url":"https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/issues/106","id":112977337,"number":106,"title":"Remove-Folder ability to disable recursion","user":{"login":"AcidUser85","id":13620987,"avatar_url":"https://avatars.githubusercontent.com/u/13620987?v=3","gravatar_id":"","url":"https://api.github.com/users/AcidUser85","html_url":"https://github.com/AcidUser85","followers_url":"https://api.github.com/users/AcidUser85/followers","following_url":"https://api.github.com/users/AcidUser85/following{/other_user}","gists_url":"https://api.github.com/users/AcidUser85/gists{/gist_id}","starred_url":"https://api.github.com/users/AcidUser85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcidUser85/subscriptions","organizations_url":"https://api.github.com/users/AcidUser85/orgs","repos_url":"https://api.github.com/users/AcidUser85/repos","events_url":"https://api.github.com/users/AcidUser85/events{/privacy}","received_events_url":"https://api.github.com/users/AcidUser85/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-23T08:37:41Z","updated_at":"2015-10-23T08:54:41Z","closed_at":null,"body":"Hello,\r\nLogically Remove-Folder should behave in similar manner as Remove-RegistryKey\r\nRemove-Folder should not delete files if there are subdirectories and files if Recurse is disabled.\r\n\r\nWhy this is needed? - it is needed for cleanup purposes, if you need to delete folder only if there are other files and subfolders - this can mean that no addtional tridparty components installed, then we are safe to remove this folder and will not brake functionality of other files.\r\n\r\nWith Remove-RegistryKey I can do nice cleanup of for example\r\n\r\n#Cleanup Addin \"AAAA\"\r\nRemove-RegistryKey -Key \"HKLM:\\SOFTWARE\\Microsoft\\Office\\15.0\\Addins\\AAAA\" -Recurse -ContinueOnError\r\n\r\n#Cleanup Addin \"BBBB\"\r\nRemove-RegistryKey -Key \"HKLM:\\SOFTWARE\\Microsoft\\Office\\15.0\\Addins\\BBBB\" -Recurse -ContinueOnError\r\n\r\n#Cleanup Addin \"CCCC\"\r\nRemove-RegistryKey -Key \"HKLM:\\SOFTWARE\\Microsoft\\Office\\15.0\\Addins\\CCCC\" -Recurse -ContinueOnError\r\n\r\n#Then we delete parent registry key if there no additional entries (addins that might be installed by third party apps)\r\nRemove-RegistryKey -Key \"HKLM:\\SOFTWARE\\Microsoft\\Office\\15.0\\Addins\" -Recurse -ContinueOnError\r\n\r\n#Then we delete parent registry key if there no additional entries (addins that might be installed by third party apps)\r\nRemove-RegistryKey -Key \"HKLM:\\SOFTWARE\\Microsoft\\Office\\15.0\" -Recurse -ContinueOnError\r\n\r\n#Then we delete parent registry key if there no additional entries (addins that might be installed by third party apps)\r\nRemove-RegistryKey -Key \"HKLM:\\SOFTWARE\\Microsoft\\Office\" -Recurse -ContinueOnError\r\n\r\n#Now we removed only original stuff and have clean registry\r\n\r\nSo it is obvious that Remove-Folder should function the same:\r\nDelete folder/subfolder and files if -Recurse specified\r\nOtherwise raise an error\r\nIf ContinueOnError specified $true - then continue.\r\n"},"comment":{"url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/comments/150517612","html_url":"https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/issues/106#issuecomment-150517612","issue_url":"https://api.github.com/repos/PSAppDeployToolkit/PSAppDeployToolkit/issues/106","id":150517612,"user":{"login":"AcidUser85","id":13620987,"avatar_url":"https://avatars.githubusercontent.com/u/13620987?v=3","gravatar_id":"","url":"https://api.github.com/users/AcidUser85","html_url":"https://github.com/AcidUser85","followers_url":"https://api.github.com/users/AcidUser85/followers","following_url":"https://api.github.com/users/AcidUser85/following{/other_user}","gists_url":"https://api.github.com/users/AcidUser85/gists{/gist_id}","starred_url":"https://api.github.com/users/AcidUser85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AcidUser85/subscriptions","organizations_url":"https://api.github.com/users/AcidUser85/orgs","repos_url":"https://api.github.com/users/AcidUser85/repos","events_url":"https://api.github.com/users/AcidUser85/events{/privacy}","received_events_url":"https://api.github.com/users/AcidUser85/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T08:54:41Z","updated_at":"2015-10-23T08:54:41Z","body":"When you delete a folder with VBScript or even with CMD.exe /C RD command it won't allow to delete folder if it contains subfolders and files until you specify option to force delete it recursively.\r\nSo this is expected functionality.\r\nI have searched and did not find any method using PSAppDeployToolkit to delete folder only if it's empty, but this would be really needed for careful cleanup.\r\n"}}