in reply to Need 2 Regex's
Your item 2 does not strike me as a regex problem. You presumably have a file name from an upload request, and a directory path where the upload should be stored. The "-f" function with a "path/name" arg will tell whether the file name exists in the directory: if ( -f "$path/$file" ). If that's true, you append a number to the file name and check again. If necessary, increment the number, append to the original file name and check again; repeat until "-f" returns false. (UPDATE: derby's suggestions above are much better -- use that instead.)
It's appalling that you've wasted a lot of time complaining about replies that "waste your time" by asking you to show what you've tried, and after all that, you apparently still have not tried anything yourself -- at least, you haven't given any evidence of having tried. So stop whining and try something. Learn by doing.
UPDATE: Actually, I'm curious about why you posted your question 1 here in the first place. It seems remarkably similar to another thread that you posted here a year ago. Did you really completely forget the advice given back then, or did you never understand it?
|
|---|