I'd like to run a command line:
cd ~/www/tmp/; rm -P 2*
But I get an error if there are no files starting with 2.
You would think I would want to use
-f Attempt to remove the files without prompting for confirmation, regardless of the file's permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error.
And I do care about file permissions- if there's something weird going on, I'd prefer the command abort. I only want to suppress 'do not exist' errors.
I've looked at some other questions with 'rm errors', and found these two which seem (kinda) relevant:
But, I don't understand everything going on in the answers to this question, and don't know that I need it?
touch hack suggested in this question:
Seems workable, as I don't think I mind the performance hit (but what type of performance hit would you take? - ie: is this a reasonably scalable technique, or am I just learning very bad habits?)
I'm not sure how I'd do an
if-then within the command line.
Are there any other options for a simple command line cut-n-paste cleanup?
find -delete work better for my case? If so, why?
error in question:
rm: 2*: No such file or directory