Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^6: Check multiple file names exist in directory and create another trigger file after existing files processed

by roboticus (Chancellor)
on Nov 22, 2017 at 21:02 UTC ( [id://1204074]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Check multiple file names exist in directory and create another trigger file after existing files processed
in thread Check multiple file names exist in directory and create another trigger file after existing files processed

vickycanada:

Hint: Try printing the contents of $destinationFilePath, and you'll get a hint at the problem you're likely having:

print "<$destinationFilePath>\n";

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.

  • Comment on Re^6: Check multiple file names exist in directory and create another trigger file after existing files processed
  • Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1204074]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 21:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found