Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re^6: Check multiple file names exist in directory and create another trigger file after existing files processedby roboticus (Chancellor) |
on Nov 22, 2017 at 21:02 UTC ( [id://1204074]=note: print w/replies, xml ) | Need Help?? |
Hint: Try printing the contents of $destinationFilePath, and you'll get a hint at the problem you're likely having:
I expect you'll see something like "<\mftshare-devTeststomoutputTest1>". Backslashes in double-quoted strings need to be escaped, otherwise they're interpreted as escaping the next character found. Oh, yes, one thing I forgot to mention (it bit me before). Sometimes your files may not be *complete* when they appear, so you need to be sure to delay processing the files until you're certain that they're done. I've had processes that would generate files, but would take several minutes to complete. Normally, I'd simply track the size of the file as well as the time I last saw the size of the file change. Then I'd process the file only after a reasonable amount of time after the file stops changing in length. You generally only have to do this when the file is being generated in or copied to the target directory. To avoid those problems, I generally advise people to generate/copy them into a temporary or working directory, and then move them to the target directory once generation/copy is complete. (Generally a move/rename operation is atomic/effectively instantaneous, so you don't need to worry about processing an incomplete file. ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|