Seems like it had done its duty, anyway, you mean to substitute
Code:
# *** THIS CODE DELETES THE STRAY JPG FILES
find "$fulldir" -maxdepth 1 -type f -print | xargs -0 rm -f $filemask
with:
Originally Posted by
drs305
Code:
find $fulldir -type f -print | sed 's/[^ ][^ ]*/"&/' | sed 's/$/"/g' rm -f $filemask
I know, very *newbie* question, but that's what I'm right now I understood? Or do I need an extra | like
Code:
find $fulldir -type f -print | sed 's/[^ ][^ ]*/"&/' | sed 's/$/"/g' | rm -f $filemask
... I am a bit confused about "|" ! Is it a "simple" && ?
You are substituting [ ^][ ^]* with "&\ and $ with "/g ? Could you explain ?
Oh, by the way, just read xargs man and here's the intersting part
Code:
Because Unix filenames can contain blanks and newlines, this default
behaviour is often problematic; filenames containing blanks and/or new‐
lines are incorrectly processed by xargs. In these situations it is
better to use the ‘-0’ option, which prevents such problems. When
using this option you will need to ensure that the program which pro‐
duces the input for xargs also uses a null character as a separator.
If that program is GNU find for example, the ‘-print0’ option does this
for you.
Doesn't it say it should already work as is? I'd like to understand, thanks for your help mate!
Bookmarks