remove empty directories - Unix

This is a discussion on remove empty directories - Unix ; Hello group, SCO UNIX Openserver 5 Do you know how to delete recursively empty directories ? Thanks. Christophe BADET...

+ Reply to Thread
Results 1 to 8 of 8

Thread: remove empty directories

  1. remove empty directories

    Hello group,

    SCO UNIX Openserver 5

    Do you know how to delete recursively empty directories ?

    Thanks.
    Christophe BADET



  2. Re: remove empty directories

    In article <4309c60e$0$12412$626a14ce@news.free.fr>,
    "Christophe BADET" wrote:

    > Hello group,
    >
    > SCO UNIX Openserver 5
    >
    > Do you know how to delete recursively empty directories ?
    >
    > Thanks.
    > Christophe BADET


    Doesn't SCO implement

    rm -rf

    --
    DeeDee, don't press that button! DeeDee! NO! Dee...




  3. Re: remove empty directories

    Hmmm,

    i want to remove only empty directories, not all directories.

    "Michael Vilain" a écrit dans le message de news:
    vilain-163496.06573422082005@comcast.dca.giganews.com...
    > In article <4309c60e$0$12412$626a14ce@news.free.fr>,
    > "Christophe BADET" wrote:
    >
    >> Hello group,
    >>
    >> SCO UNIX Openserver 5
    >>
    >> Do you know how to delete recursively empty directories ?
    >>
    >> Thanks.
    >> Christophe BADET

    >
    > Doesn't SCO implement
    >
    > rm -rf
    >
    > --
    > DeeDee, don't press that button! DeeDee! NO! Dee...
    >
    >
    >




  4. Re: remove empty directories

    Michael Vilain writes:

    > In article <4309c60e$0$12412$626a14ce@news.free.fr>,
    > "Christophe BADET" wrote:
    >
    >> Hello group,
    >>
    >> SCO UNIX Openserver 5
    >>
    >> Do you know how to delete recursively empty directories ?
    >>
    >> Thanks.
    >> Christophe BADET

    >
    > Doesn't SCO implement
    >
    > rm -rf
    >


    I am sure that the OP doesn't want to delete non-empty directories
    (i.e. those containing regular files) ...

    Maybe something along the line of

    find . -type f -prune

    or whatever syntax SCO uses ...

    --
    Dragan Cvetkovic,

    To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer

    !!! Sender/From address is bogus. Use reply-to one !!!

  5. Re: remove empty directories

    j'ai trouvé:

    find . -type d -exec rmdir {} 2>/dev/null

    "Dragan Cvetkovic" a écrit dans le message de news:
    lm64tyt62c.fsf@privacy.net...
    > Michael Vilain writes:
    >
    >> In article <4309c60e$0$12412$626a14ce@news.free.fr>,
    >> "Christophe BADET" wrote:
    >>
    >>> Hello group,
    >>>
    >>> SCO UNIX Openserver 5
    >>>
    >>> Do you know how to delete recursively empty directories ?
    >>>
    >>> Thanks.
    >>> Christophe BADET

    >>
    >> Doesn't SCO implement
    >>
    >> rm -rf
    >>

    >
    > I am sure that the OP doesn't want to delete non-empty directories
    > (i.e. those containing regular files) ...
    >
    > Maybe something along the line of
    >
    > find . -type f -prune
    >
    > or whatever syntax SCO uses ...
    >
    > --
    > Dragan Cvetkovic,
    >
    > To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
    >
    > !!! Sender/From address is bogus. Use reply-to one !!!




  6. Re: remove empty directories

    Christophe BADET wrote:
    >
    > find . -type d -exec rmdir {} 2>/dev/null


    This will only trim the bottom because none of the
    parent directories will be empty. The OP seemed
    to want to start at the bottom, delete all empty
    directories, and to keep deleting when those
    deletions emptied parents. Add a -depth clause:

    find . -depth -type d -exec rmdir {} 2>/dev/null

    I prefer an ending like: -print | xargs -1 rmdir
    but that only works if you know in advance there are
    no interesting characters in file names.

    Any non-empty directory will fail on its deletion,
    no non-directory entries will be deleted.


  7. Re: remove empty directories

    Doug Freyburger wrote:
    > Christophe BADET wrote:
    >
    >>find . -type d -exec rmdir {} 2>/dev/null

    >
    >
    > This will only trim the bottom because none of the
    > parent directories will be empty. The OP seemed
    > to want to start at the bottom, delete all empty
    > directories, and to keep deleting when those
    > deletions emptied parents. Add a -depth clause:
    >
    > find . -depth -type d -exec rmdir {} 2>/dev/null
    >
    > I prefer an ending like: -print | xargs -1 rmdir
    > but that only works if you know in advance there are
    > no interesting characters in file names.
    >
    > Any non-empty directory will fail on its deletion,
    > no non-directory entries will be deleted.
    >


    what about:

    find . -empty -type d | xargs rmdir

    Assuming SCO uses the gnu find

    Mark

  8. Re: remove empty directories

    On Tue, 23 Aug 2005 17:06:10 -0400, Mark wrote:

    > what about:
    > find . -empty -type d | xargs rmdir
    > Assuming SCO uses the gnu find


    Haven't been keeping up with the news, have you Mark?


+ Reply to Thread