Issues with rm and rmdir
Mark Phillips
mark at phillipsmarketing.biz
Mon Sep 10 15:58:20 UTC 2018
Michael,
ls -a in .git returns
. .. (a period and a double period)
I had tried this before, and assumed the .git directory was empty.
Arkadiusz,
rm --help returns
user at localhost:~/python-projects$ rm --help
Usage: rm [OPTION]... [FILE]...
Remove (unlink) the FILE(s).
-f, --force ignore nonexistent files and arguments, never prompt
-i prompt before every removal
-I prompt once before removing more than three files,
or
when removing recursively; less intrusive than -i,
while still giving protection against most
mistakes
--interactive[=WHEN] prompt according to WHEN: never, once (-I), or
always (-i); without WHEN, prompt always
--one-file-system when removing a hierarchy recursively, skip any
directory that is on a file system different from
that of the corresponding command line argument
--no-preserve-root do not treat '/' specially
--preserve-root do not remove '/' (default)
*-r, -R, --recursive remove directories and their contents recursively*
-d, --dir remove empty directories
-v, --verbose explain what is being done
--help display this help and exit
--version output version information and exit
By default, rm does not remove directories. *Use the --recursive (-r or
-R)*
*option to remove each listed directory, too, along with all of its
contents.*
busybox | head -1 returns
BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3) multi-call binary.
rm -rf foo, rm -rf foo/.git and inside of foo/ rm -rf .git all yield the
same error message - .git is not empty. However, as I mentioned above, ls
-a in foo/.git shows that .git is empty.
git is installed in my busybox, which is why I tried git rm foo/ and git rm
foo/.git, and inside foo/ git rm .git. All returned the same error message.
Any other suggestions for removing my 'foo' directory would be greatly
appreciated.
Thanks!
Mark
On Mon, Sep 10, 2018 at 4:13 AM, Arkadiusz Drabczyk <arkadiusz at drabczyk.org>
wrote:
> On 2018-09-10, Mark Phillips <mark at phillipsmarketing.biz> wrote:
> > I have busybox running Ubuntu on a Samsung tablet (
> https://userland.tech/).
> > I have git setup to retrieve some of my code repositories. I tried a git
> > clone with an typo in the name of the repository, so none of the code was
> > downloaded, but git did create a directory foo with a .git directory
> > underneath it. I managed to download the correct repository after fixing
> > the typo.
> >
> > However, I cannot remove the directory foo. I have tried
> >
> > rm -r -f -d foo/
>
> Busybox rm has no -d. Didn't you get `rm: invalid option -- 'd''
> error? If you didn't you might not use busybox. Try `busybox rm -r
> -f -d foo' and you should get the error.
>
> > rmdir foo/
>
> It won't work. Both GNU coreutils and busybox implementations of
> rmdir will remove target directory only if it's empty. It's also
> specified by POSIX:
> http://pubs.opengroup.org/onlinepubs/000095399/functions/rmdir.html
>
> > git rm -rf foo/
>
> git is not a busybox command.
>
> > I even tried sudo rm.... and that did not work.
> >
> > The error message in all cases is
> > rm: cannot remove 'foo'/.git: Directory is not empty.
> >
> > However, there is nothing in the foo/.git directory.
>
> Do you try to remove foo or foo/.git?
>
> > I tried the all same commands on foo/.git, with the same results.
> >
> > Am I missing something?
>
> Probably yes. The -d you used with rm is probably unneeded. Try:
>
> rm -rf foo
>
> --
> Arkadiusz Drabczyk <arkadiusz at drabczyk.org>
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20180910/31b5e794/attachment.html>
More information about the busybox
mailing list