Argument list too long

해당 디렉토리로 가서 아래 스크립트 실행

for file in $(ls)
    rm -fv $file

안써먹으니 이 간단한것도 기억에서 잊혀진다.

# find ./ -name "*.log" -print0 


# find ./ -name "*.log" -print0 | xargs -0 rm -f
# ls

다 지워 졌음.



find 옵션

True; print the full file name on the standard output, followed by a null
character (instead of the newline character that '-print' uses). This
allows file names that contain newlines or other types of white space to be
correctly interpreted by programs that process the find output. This option
corresponds to the '-0' option of xargs.



xargs 옵션

--null, -0

Input items are terminated by a null character instead of by whitespace, and
the quotes and backslash are not special (every character is taken liter-
ally). Disables the end of file string, which is treated like any other
argument. Useful when input items might contain white space, quote marks,
or backslashes. The GNU find -print0 option produces input suitable for
this mode.

유용했던 자료를 기록해 두었습니다. 도움이 되시길~~~ Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you fun

받은 트랙백이 없고 , 댓글이 없습니다.