How to create a directory in Magento 2 Programmatically?

How to create a new Folder or Directory Magento 2?
When you are working for a custom module in Magento 2 and need to add the log to the custom file inside the var/log folder.

Log folder contains the multiple log files and if you want to create a new folder for your custom log of the module, You can create a New Folder programmatically using WriteInterface. Continue reading “How to create a directory in Magento 2 Programmatically?”

How to verify is Directory exists at specific path Magento 2?

Many times you need to verify the current path is a regular directory or not in Magento 2 and if directory exists you need to create a new file or do some custom logic.

But How you can verify this path is a directory or not using
Magento 2, You can verify the given path is the regular directory or not. Continue reading “How to verify is Directory exists at specific path Magento 2?”