Updated script to write directory name as part of search text