Re: [OpenIndiana-discuss] Deleting empty directories

2023-08-02 Thread Michelle
Thanks Tim.

That's very useful learning info. I didn't know about the --prune-
empty-dirs option.

I guess I'm guilty of cribbing what I need from the internet and never
learning things properly.

Oh for the time to do all the things I would like to!

Many thanks,

Michelle.

On Wed, 2023-08-02 at 16:32 -0500, Tim Mooney via openindiana-discuss
wrote:
> In regard to: [OpenIndiana-discuss] Deleting empty directories,
> Michelle...:
> 
> > Basically, I extract all the flac files out of my main music
> > collection, to a separate location, (using rsync) and then I have
> > to
> > delete the empty directories that rsync has created.
> 
> You could use '--prune-empty-dirs' with rsync.
> 
> > I managed the first part, no problem. However, it's the deleting of
> > empty directories that is causing me trouble.
> > 
> > The Linux command is...
> > find /mnt/jaguar/users/michelle/FlacCopy -type d -empty -delete
> > ...however the OI version of find doesn't support -empty
> 
> No, but it supports '-depth', which means you can
> 
> find /mnt/jaguar/users/michelle/FlacCopy -depth -type d \
> -exec rmdir {} \; 2>/dev/null
> 
> That will fail *a lot*, but the error messages are thrown away and
> the
> empty directories will be deleted.
> 
> or if you have GNU fileutils installed (so 'grmdir' exists)
> 
> find /mnt/jaguar/users/michelle/FlacCopy -depth -type d \
> -exec grmdir --ignore-fail-on-non-empty {} \;
> 
> -depth is important for either of these to work.
> 
> The best part of both of those is that you can insert 'echo' between
> '-exec' and the start of the command, and it will show you what it's
> going to do without doing it.  If you like what you see, just remove
> the
> 'echo'.
> 
> > I've tried to install gfind, but that doesn't appear to be
> > available.
> 
> Someone else already answered with the correct pkg FMRI.
> 
> Tim


___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


Re: [OpenIndiana-discuss] Deleting empty directories

2023-08-02 Thread Michelle
Many thanks Volker.

That'll do the trick.

Michelle.

On Wed, 2023-08-02 at 23:19 +0200, Volker A. Brandt wrote:
> Michelle writes:
> [...]
> > I've tried to install gfind, but that doesn't appear to be
> > available.
> 
> gfind is in the package "file/gnu-findutils".
> 
> 
> Best regards -- Volker


___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


Re: [OpenIndiana-discuss] Deleting empty directories

2023-08-02 Thread Tim Mooney via openindiana-discuss

In regard to: [OpenIndiana-discuss] Deleting empty directories, Michelle...:


Basically, I extract all the flac files out of my main music
collection, to a separate location, (using rsync) and then I have to
delete the empty directories that rsync has created.


You could use '--prune-empty-dirs' with rsync.


I managed the first part, no problem. However, it's the deleting of
empty directories that is causing me trouble.

The Linux command is...
find /mnt/jaguar/users/michelle/FlacCopy -type d -empty -delete
...however the OI version of find doesn't support -empty


No, but it supports '-depth', which means you can

find /mnt/jaguar/users/michelle/FlacCopy -depth -type d \
-exec rmdir {} \; 2>/dev/null

That will fail *a lot*, but the error messages are thrown away and the
empty directories will be deleted.

or if you have GNU fileutils installed (so 'grmdir' exists)

find /mnt/jaguar/users/michelle/FlacCopy -depth -type d \
-exec grmdir --ignore-fail-on-non-empty {} \;

-depth is important for either of these to work.

The best part of both of those is that you can insert 'echo' between
'-exec' and the start of the command, and it will show you what it's
going to do without doing it.  If you like what you see, just remove the
'echo'.


I've tried to install gfind, but that doesn't appear to be available.


Someone else already answered with the correct pkg FMRI.

Tim
--
Tim Mooney tim.moo...@ndsu.edu
Enterprise Computing & Infrastructure /
Division of Information Technology/701-231-1076 (Voice)
North Dakota State University, Fargo, ND 58105-5164

___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


Re: [OpenIndiana-discuss] Deleting empty directories

2023-08-02 Thread Volker A. Brandt
Michelle writes:
[...]
> I've tried to install gfind, but that doesn't appear to be available.

gfind is in the package "file/gnu-findutils".


Best regards -- Volker
-- 

Volker A. BrandtConsulting and Support for Solaris-based Systems
Brandt & Brandt Computer GmbH   WWW: http://www.bb-c.de/
Am Wiesenpfad 6, 53340 Meckenheim, GERMANYEmail: v...@bb-c.de
Handelsregister: Amtsgericht Bonn, HRB 10513  Schuhgröße: 46
Geschäftsführer: Rainer J.H. Brandt und Volker A. Brandt

Mastodon: @vab@bonn.socialThreema: ID available upon request

___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss


[OpenIndiana-discuss] Deleting empty directories

2023-08-02 Thread Michelle
At the moment I'm doing something on an OI server which is executed by
a Linux client. However, due to the "Resource temporarily unavailable
(11)" through the linux mounting (even with the cache off, etc.) I'm
having to try and replicate this on the OI server itself.

Basically, I extract all the flac files out of my main music
collection, to a separate location, (using rsync) and then I have to
delete the empty directories that rsync has created.

I managed the first part, no problem. However, it's the deleting of
empty directories that is causing me trouble.

The Linux command is...
find /mnt/jaguar/users/michelle/FlacCopy -type d -empty -delete
...however the OI version of find doesn't support -empty

I've tried to install gfind, but that doesn't appear to be available.

I've tried to follow various scripts... (the below is just to print
empty directories at the moment, for testing)
find /mnt/jaguar/users/michelle/FlacCopy -type d | xargs -i ls -ed {} |
awk '{if ($5=="2"){ print $0 }}'
...but I fall foul that some of the names in the directories contain '
(eg. Sinead O'Connor) which then causes the command to fail with,
"xargs: Missing quote"

Any clues would be gratefully received.

Michelle.

___
openindiana-discuss mailing list
openindiana-discuss@openindiana.org
https://openindiana.org/mailman/listinfo/openindiana-discuss