Friday, February 11, 2011

SHARE - How to know file that generated using background job already created or not

Sometimes we need to know file that generated using background job already created or not.

We can check that file already exist, readable and created using this method.

We can use this to check file already exist or not

File.exist?(file_path)
#true if file exist
#false if not exist



We can use this to check file readable or not

File.readable?(file_path)
#true if file readable
#false if not readable


We need this to check file already finish created or not

File.zero?(file_path)
#true if file exist but not yet finish created
#false if file exist and already created

No comments:

Post a Comment