From: Jon LaBadie on
Fred wrote:
> On Sep 23, 4:59 am, Dave <davefredri...(a)casema.nl> wrote:
>> On 23 sep, 13:54, Jim <shakahsha...(a)gmail.com> wrote:
>>
>>> On Sep 23, 6:48 am, Dave <davefredri...(a)casema.nl> wrote:
>>>> Hello all, simple question:
>>>> as ROOT how can i remove this directory (command?):
>>>> w\'berg s?zeel
>>>> There is a \ backslash and a space in the dir name.
>>> Can you put the dirname in quotes when doing the rm, e.g.:
>>> rm -rf "w\'berg s?zeel"
>> Someone else have done it for me, with this command:
>>
>> rm -rf "w\'berg s�zeel"
>>
>> I don't know why the ? was replaced by the � but it is removed now.
>
> I have found that the easiest way to removefiles/directories that
> contain special characters is to use rm -i and then answer
> yes or no. So you could have used
> rm -rfi *zeel
>

And there is always a horror story for any technique.

I fumble fingered a space between the 'dash' and 'eye' and did

rm - i *

When I saw "rm: i: no such file or directory", all I could say
was Oh doodoo.
From: Barry Margolin on
In article <h9dea2$uhr$2(a)news.eternal-september.org>,
Jon LaBadie <jlabadie(a)aXcXm.org> wrote:

> Fred wrote:
> > On Sep 23, 4:59 am, Dave <davefredri...(a)casema.nl> wrote:
> >> On 23 sep, 13:54, Jim <shakahsha...(a)gmail.com> wrote:
> >>
> >>> On Sep 23, 6:48 am, Dave <davefredri...(a)casema.nl> wrote:
> >>>> Hello all, simple question:
> >>>> as ROOT how can i remove this directory (command?):
> >>>> w\'berg s?zeel
> >>>> There is a \ backslash and a space in the dir name.
> >>> Can you put the dirname in quotes when doing the rm, e.g.:
> >>> rm -rf "w\'berg s?zeel"
> >> Someone else have done it for me, with this command:
> >>
> >> rm -rf "w\'berg s�zeel"
> >>
> >> I don't know why the ? was replaced by the � but it is removed now.
> >
> > I have found that the easiest way to removefiles/directories that
> > contain special characters is to use rm -i and then answer
> > yes or no. So you could have used
> > rm -rfi *zeel
> >
>
> And there is always a horror story for any technique.
>
> I fumble fingered a space between the 'dash' and 'eye' and did
>
> rm - i *
>
> When I saw "rm: i: no such file or directory", all I could say
> was Oh doodoo.

That's what backups are for.

If the worst you could say was "doodoo", I guess the files couldn't have
been that important. :)

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
From: steven_nospam at Yahoo! Canada on
On Sep 23, 7:59 am, Dave <davefredri...(a)casema.nl> wrote:
> On 23 sep, 13:54, Jim <shakahsha...(a)gmail.com> wrote:
>
> > On Sep 23, 6:48 am, Dave <davefredri...(a)casema.nl> wrote:
>
> > > Hello all, simple question:
>
> > > as ROOT how can i remove this directory (command?):
>
> > > w\'berg s?zeel
>
> > > There is a \ backslash and a space in the dir name.


Another way of deleting it would be to use the inode number.

# ls -id *eel
421 w\'berg s?zeel

# find . -inum 421 -exec /bin/ls -d {} \;

When you are sure that only one filename showed up for the -exec
portion, you can alter the find command to use rmdir or /bin/rm -R
instead.

This works on AIX 5L systems.


Steve
From: David Combs on
In article <h9dea2$uhr$2(a)news.eternal-september.org>,
Jon LaBadie <jlabadie(a)aXcXm.org> wrote:
>Fred wrote:
>> On Sep 23, 4:59 am, Dave <davefredri...(a)casema.nl> wrote:
>>> On 23 sep, 13:54, Jim <shakahsha...(a)gmail.com> wrote:
>>>
>>>> On Sep 23, 6:48 am, Dave <davefredri...(a)casema.nl> wrote:
>>>>> Hello all, simple question:
>>>>> as ROOT how can i remove this directory (command?):
>>>>> w\'berg s?zeel
>>>>> There is a \ backslash and a space in the dir name.
>>>> Can you put the dirname in quotes when doing the rm, e.g.:
>>>> rm -rf "w\'berg s?zeel"
>>> Someone else have done it for me, with this command:
>>>
>>> rm -rf "w\'berg s�zeel"
>>>
>>> I don't know why the ? was replaced by the � but it is removed now.
>>
>> I have found that the easiest way to removefiles/directories that
>> contain special characters is to use rm -i and then answer
>> yes or no. So you could have used
>> rm -rfi *zeel
>>
>
>And there is always a horror story for any technique.
>
>I fumble fingered a space between the 'dash' and 'eye' and did
>
> rm - i *
>
>When I saw "rm: i: no such file or directory", all I could say
>was Oh doodoo.

I use tcsh (upgraded version of csh), and it has, as do many other
shells, "aliases", and by far the most important of these is:

alias rm 'rm -i'

For double safety (esp when there's an asterisk somewhere),
change the rm to mv:

mv stuff-with-pattern ~/todelete/todelete/todelete

THEN, cd and go look at what got moved down there -- any mistakes,
move them back up to where they came from.

Then, and ONLY then, delete them.


Safer yet: use emacs's "dired"; then you can individually "d"
each file to delete, even via regexp. The result of that
is the directory listing (which is what dired is all about anyway),
and at the left margin will be a "D" on those you've marked for
deletion.

Only when ready do you hit "x", which deletes them all.

----

Want to try emacs? Get it, start it, and hit "control-H t" (tee, for "tutorial").

After finishing that (the guru himself wrote the thing (well, plus emacs
itself) 20 years, no, more, years ago, then do: control-H i (eye, for "info",
and cursor down to the word "emacs" and hit "m" when next to it).

Also, just for the hell of it, do "control-x d", which will get
you into dired of the current directory.

Then go back to *info* and learn about dired.

Then say M-x load-library dired-x - and back in *info*,
one level up from "emacs", read about dired-x.

You do that, and you will NEVER leave emacs (as now being
your favorite editor). And you will "live" in *shell*.

And start reading gnu.emacs.help newsgroup.


Cheers!

David



From: Chris F.A. Johnson on
On 2009-10-04, David Combs wrote:
....
> You do that, and you will NEVER leave emacs (as now being
> your favorite editor). And you will "live" in *shell*.

I use emacs as a text editor.

With the exception of one piece of software, I don't use the emacs
shell because it is nowehere near as useful as a real terminal
emulator (I like rxvt best).

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence