Suppose I have a file dir1/this_file.txt
and dir2/this_file.txt
, and I want to insert different boilerplate code not based on the file name or extension, but based on the directory in which the file is created. How can I do that?
-- Edit --
Additionally, what if the boilerplate code depends on the filename of the file being created?