Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty folder removal does not work due to wrong find command #1

Closed
seertenedos opened this issue Nov 30, 2019 · 2 comments
Closed

empty folder removal does not work due to wrong find command #1

seertenedos opened this issue Nov 30, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@seertenedos
Copy link

folder cleanup looks like it works from the logs as you can see below but it actuall does not work.

2019-12-01 06:24:50,569 - DEBUG      - path                 - remove_empty_dirs              - Removing empty directories from '/data/main' with mindepth 1
2019-12-01 06:24:50,570 - DEBUG      - path                 - remove_empty_dirs              - Using: find /data/main -mindepth 1 -type d -empty -delete
2019-12-01 06:24:50,585 - INFO       - uploader             - remove_empty_dirs              - Removed empty directories from '/data/main' with mindepth: 1

I logged into the container and ran /data/main -mindepth 1 -type d -empty -delete manually and got an error below

find /data/main -mindepth 1 -type d -empty -delete
find: unrecognized: -empty
BusyBox v1.30.1 (2019-06-12 17:51:55 UTC) multi-call binary.

Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS]

Search for files and perform actions on them.
First failed action stops processing of current file.
Defaults: PATH is current directory, action is '-print'

        -L,-follow      Follow symlinks
        -H              ...on command line only
        -xdev           Don't descend directories on other filesystems
        -maxdepth N     Descend at most N levels. -maxdepth 0 applies
                        actions to command line arguments only
        -mindepth N     Don't act on first N levels
        -depth          Act on directory *after* traversing it

Actions:
        ( ACTIONS )     Group actions for -o / -a
        ! ACT           Invert ACT's success/failure
        ACT1 [-a] ACT2  If ACT1 fails, stop, else do ACT2
        ACT1 -o ACT2    If ACT1 succeeds, stop, else do ACT2
                        Note: -a has higher priority than -o
        -name PATTERN   Match file name (w/o directory name) to PATTERN
        -iname PATTERN  Case insensitive -name
        -path PATTERN   Match path to PATTERN
        -ipath PATTERN  Case insensitive -path
        -regex PATTERN  Match path to regex PATTERN
        -type X         File type is X (one of: f,d,l,b,c,s,p)
        -executable     File is executable
        -perm MASK      At least one mask bit (+MASK), all bits (-MASK),
                        or exactly MASK bits are set in file's mode
        -mtime DAYS     mtime is greater than (+N), less than (-N),
                        or exactly N days in the past
        -mmin MINS      mtime is greater than (+N), less than (-N),
                        or exactly N minutes in the past
        -newer FILE     mtime is more recent than FILE's
        -inum N         File has inode number N
        -user NAME/ID   File is owned by given user
        -group NAME/ID  File is owned by given group
        -size N[bck]    File size is N (c:bytes,k:kbytes,b:512 bytes(def.))
                        +/-N: file size is bigger/smaller than N
        -links N        Number of links is greater than (+N), less than (-N),
                        or exactly N
        -prune          If current file is directory, don't descend into it
If none of the following actions is specified, -print is assumed
        -print          Print file name
        -print0         Print file name, NUL terminated
        -exec CMD ARG ; Run CMD with all instances of {} replaced by
                        file name. Fails if CMD exits with nonzero
        -exec CMD ARG + Run CMD with {} replaced by list of file names
        -delete         Delete current file/directory. Turns on -depth option
        -quit           Exit
@seertenedos
Copy link
Author

i also found a similar post for another container with a similar issue where the following was suggested to fix it.

RUN apk --no-cache add findutils && \
    rm -rf /var/cache/apk/*

@sabrsorensen sabrsorensen self-assigned this Dec 1, 2019
@sabrsorensen sabrsorensen added the bug Something isn't working label Dec 1, 2019
@sabrsorensen
Copy link
Owner

Good find, thanks for taking the time to submit an issue! I have your fix added and a build will be ready shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants