diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index c416f49ce..40e67575f 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -88,9 +88,7 @@ EOF shift # Go back to original working directory - # and remove extraction directory if there was an error builtin cd -q "$pwd" - (( success > 0 )) && command rm -r "$extract_dir" # If content of extract dir is a single directory, move its contents up # Glob flags: @@ -102,6 +100,8 @@ EOF if [[ ${#content} -eq 1 && -d "${content[1]}" ]]; then command mv -f "${content[1]}" . command rmdir "$extract_dir" + elif [[ ${#content} -eq 0 ]]; then + command rmdir "$extract_dir" fi done }