Check given path is of directory or direct file path

Dear Forum members

I have an excel file and in that file in a column i have some directory path and in some cell i have direct path of file(including file name and extension), so how i can check the given path is of directory or direct file path.

Thankx in advance

@Yankit_singh What are extensions of files for the full file path?

Thankx for response

Extensions of full file path are .txt, .pdf, .doc, .xlsx

Use GetExtension method

  1. Directory path will give you empty:

  2. Full path will give you extention

Then use if condition with if value is empty then it’s directory path or else full file path…

Thankx buddy

It’s working fine.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.