Tiny Core Extensions > TCE Q&A Forum

tcz-uninstall.tce - does it have the -f option

<< < (7/9) > >>

Jason W:
Adding findutils as a dependency and a one liner like this would get rid of the empty directories ( I am on windows now but here is off the top of my head):

find /tmp/tcloop/"$APP" -type d -empty -print0 | \
sed "s:\/tmp\/tcloop\/"$APP"::"| xargs -0 rm -r

Especially with the window manager changes this script needed some attention, hopefully the next update will be pretty much polish it off.  Thanks for the ideas and feedback.

curaga:
Without requiring findutils, one could just:

--- Quote ---find /tmp/tcloop/"$APP" -type d | sed "s@\/tmp\/tcloop\/${APP}@@" | xargs rmdir
--- End quote ---
I haven't tested this code, but rmdir doesn't remove a directory if there's even a single file.

Jason W:
Thanks curaga, I added that and it saved a few lines of test cases and such and the need for findutils.

Sudo was missing in a couple of places, hence files left behind.  Hopefully fixed the remaining bugs, uploaded the result.  Hopefully all that is left now is supporting the different window managers.

jpeters:

--- Quote from: curaga on May 25, 2009, 08:01:06 AM ---Without requiring findutils, one could just:

--- Quote ---find /tmp/tcloop/"$APP" -type d | sed "s@\/tmp\/tcloop\/${APP}@@" | xargs rmdir
--- End quote ---
I haven't tested this code, but rmdir doesn't remove a directory if there's even a single file.

--- End quote ---

Doesn't this yield "/"    ?    (I don't understand the sed 's@/dir/dir@@'   part  ) 

curaga:
/ has files in it, thus it doesn't get removed

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version