File variable naming standard

I am often working with files and I always get myself in a bit of a knot around what to name my varialbes when I am working with directories and files.
This is the standard that I use:

  1. filePath – This is the variable that gives you the directory path to a file e.g. c:\temp
  2. fileName – This is the name of a file, just the filename with no folder path. e.g. test.log
  3. file – This is the full filepath and file name for the file, e.g. c:\temp\test.log

Using this standard leads to some consistency when trying to read my code.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.