* How to delete current directory
@ 2006-07-06 10:14 zzapper
2006-07-06 14:33 ` Marc Chantreux
0 siblings, 1 reply; 8+ messages in thread
From: zzapper @ 2006-07-06 10:14 UTC (permalink / raw)
To: zsh-users
Hi
Don't know whether this is useful/dangerous.
How to delete current directory (and any files) picking up directory name
from $PWD (you also need to move out of directory first)
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to delete current directory
2006-07-06 10:14 How to delete current directory zzapper
@ 2006-07-06 14:33 ` Marc Chantreux
2006-07-06 14:42 ` zzapper
2006-07-06 17:03 ` Bart Schaefer
0 siblings, 2 replies; 8+ messages in thread
From: Marc Chantreux @ 2006-07-06 14:33 UTC (permalink / raw)
To: zsh-users
hi,
alias lrm='cd ..; rm -rf $OLDPWD'
regards
mc
zzapper wrote:
> Hi
> Don't know whether this is useful/dangerous.
>
> How to delete current directory (and any files) picking up directory name
> from $PWD (you also need to move out of directory first)
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to delete current directory
2006-07-06 14:33 ` Marc Chantreux
@ 2006-07-06 14:42 ` zzapper
2006-07-06 17:03 ` Bart Schaefer
1 sibling, 0 replies; 8+ messages in thread
From: zzapper @ 2006-07-06 14:42 UTC (permalink / raw)
To: zsh-users
Marc Chantreux <marc.chantreux@ulpmm.u-strasbg.fr> wrote in
news:44AD1F50.8010705@ulpmm.u-strasbg.fr:
> hi,
>
> alias lrm='cd ..; rm -rf $OLDPWD'
>
> regards
> mc
Like it, I was cleaning up some old directories which had similar numeric
hard to remember names.
zzapper
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to delete current directory
2006-07-06 14:33 ` Marc Chantreux
2006-07-06 14:42 ` zzapper
@ 2006-07-06 17:03 ` Bart Schaefer
2006-07-07 7:48 ` Marc Chantreux
2006-07-07 11:13 ` zzapper
1 sibling, 2 replies; 8+ messages in thread
From: Bart Schaefer @ 2006-07-06 17:03 UTC (permalink / raw)
To: zsh-users
On Jul 6, 4:33pm, Marc Chantreux wrote:
}
} alias lrm='cd ..; rm -rf $OLDPWD'
I'd suggest a small change:
alias ;rm='cd .. && rm -rf $OLDPWD'
If for any reason the "cd" were to fail, unlikely as that may be, you
wouldn't want to rm the wrong $OLDPWD.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to delete current directory
2006-07-06 17:03 ` Bart Schaefer
@ 2006-07-07 7:48 ` Marc Chantreux
2006-07-07 11:13 ` zzapper
1 sibling, 0 replies; 8+ messages in thread
From: Marc Chantreux @ 2006-07-07 7:48 UTC (permalink / raw)
To: zsh-users
Bart Schaefer wrote:
> I'd suggest a small change:
> alias ;rm='cd .. && rm -rf $OLDPWD'
> If for any reason the "cd" were to fail, unlikely as that may be, you
> wouldn't want to rm the wrong $OLDPWD.
cd failed ? all right : don't use lrm in / ! ;)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to delete current directory
2006-07-06 17:03 ` Bart Schaefer
2006-07-07 7:48 ` Marc Chantreux
@ 2006-07-07 11:13 ` zzapper
2006-07-08 18:36 ` Bart Schaefer
1 sibling, 1 reply; 8+ messages in thread
From: zzapper @ 2006-07-07 11:13 UTC (permalink / raw)
To: zsh-users
Bart Schaefer <schaefer@brasslantern.com> wrote in
news:060706100353.ZM6522@torch.brasslantern.com:
> On Jul 6, 4:33pm, Marc Chantreux wrote:
> }
> } alias lrm='cd ..; rm -rf $OLDPWD'
>
> I'd suggest a small change:
>
> alias ;rm='cd .. && rm -rf $OLDPWD'
>
> If for any reason the "cd" were to fail, unlikely as that may be, you
> wouldn't want to rm the wrong $OLDPWD.
>
>
Is there are mechanism in zsh which will allow the rm -r to start off in
confirm mode ie "do you want to delete this file" and then choose "all"??
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to delete current directory
2006-07-07 11:13 ` zzapper
@ 2006-07-08 18:36 ` Bart Schaefer
2006-07-10 16:14 ` zzapper
0 siblings, 1 reply; 8+ messages in thread
From: Bart Schaefer @ 2006-07-08 18:36 UTC (permalink / raw)
To: zsh-users
On Jul 7, 11:13am, zzapper wrote:
} Subject: Re: How to delete current directory
}
} > alias lrm='cd .. && rm -rf $OLDPWD'
} >
} > If for any reason the "cd" were to fail, unlikely as that may be, you
} > wouldn't want to rm the wrong $OLDPWD.
} >
} >
} Is there are mechanism in zsh which will allow the rm -r to start off in
} confirm mode ie "do you want to delete this file" and then choose "all"??
unalias lrm
function lrm {
setopt localoptions glob_dots no_rm_star_silent
cd .. || return
rm -rf $OLDPWD/* && rmdir $OLDPWD
[[ ! -d $OLDPWD ]] || { cd $OLDPWD && return 1 }
}
I rigged it so that if you say "no" you don't even change directories.
You could even throw rm_start_wait onto the end of the setopt if you
are extra-paranoid.
Unfortunately saying "no" doesn't cause "rm" to return a failure status,
so the "rmdir" is attempted either way.
Aside to zsh-workers: It'd be nice if I didn't have to setopt glob_dots
there, but
rm -rf $OLDPWD/*(D)
does not trigger rm_star handling because "*(D)" != "*". That seems a
bad thing.
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How to delete current directory
2006-07-08 18:36 ` Bart Schaefer
@ 2006-07-10 16:14 ` zzapper
0 siblings, 0 replies; 8+ messages in thread
From: zzapper @ 2006-07-10 16:14 UTC (permalink / raw)
To: zsh-users
Bart Schaefer <schaefer@brasslantern.com> wrote in news:060708113648.ZM8815
@torch.brasslantern.com:
> function lrm {
> setopt localoptions glob_dots no_rm_star_silent
> cd .. || return
> rm -rf $OLDPWD/* && rmdir $OLDPWD
> [[ ! -d $OLDPWD ]] || { cd $OLDPWD && return 1 }
> }
>
BS
That's cool displays directory name before you confirm delete
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-07-10 16:15 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-06 10:14 How to delete current directory zzapper
2006-07-06 14:33 ` Marc Chantreux
2006-07-06 14:42 ` zzapper
2006-07-06 17:03 ` Bart Schaefer
2006-07-07 7:48 ` Marc Chantreux
2006-07-07 11:13 ` zzapper
2006-07-08 18:36 ` Bart Schaefer
2006-07-10 16:14 ` zzapper
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).