Path Placeholders in Search Terms

You can use path placeholders in the search term and the replacement string to search for or replace with part or all of the path and the file name of the file that is being searched through. When searching or replacing through all open files, the values for these placeholders automatically change as the search progresses to the next file. In the examples below, the file being edited is C:\data\files\web\log\foo.bar.txt. If the current file is untitled, all the placeholders below will be replaced with nothing.

If the file was opened via FTP, use %FTPFILE% to specify the full path to the file on the FTP server. %FTPSERVER% is the domain name of the server, and %FTPURL%: the full ftp:// URL to the file. You can prefix the placeholders listed below with FTP to get various parts of the path to the file on the server (excluding the domain name). %FTPDRIVE%, though not an error, will always be blank. %FTPPATH% has a leading forward slash while %FTPFOLDER% does not.

If the file is part of a project, you can use %PROJECTFILE% to reference the full path to the .epp file that the project was saved into. You can prefix the placeholders listed below with PROJECT to get the various parts of the path to the .epp file.

PlaceholderMeaningExample
%FILE%The entire path plus filename to the fileC:\data\files\web\log\foo.bar.txt
%FILENAME%The file name without pathfoo.bar.txt
%FILENAMENOEXT%The file name without the extensionfoo.bar
%FILENAMENODOT%The file name cut off at the first dotfoo
%FILEEXT%The extension of the file name without the dottxt
%FILELONGEXT%Everything in the file name after the first dotbar.txt
%PATH%The full path without trailing delimiter to the fileC:\data\files\web\log
%DRIVE%The drive the file is on, without trailing delimiterC: for drive letter paths; \\server for UNC paths
%FOLDER%The full path without the drive and without leading or trailing delimitersdata\files\web\log
%FOLDER1%First folder in the pathdata
%FOLDER2%Second folder in the pathfiles
(...etc...)
%FOLDER99%99th folder in the path.(nothing)
%FOLDER<1%Last folder in the pathlog
%FOLDER<2%Second folder from the end in the pathweb
(...etc...)
%FOLDER<99%99th folder from the end in the path.(nothing)
%PATH1%First folder in the path, without delimitersdata
%PATH2%First two folders in the path, without leading or trailing delimitersdata\files
(...etc...)
%PATH99%First 99 folders in the path, without leading or trailing delimitersdata\files\web\log
%PATH<1%Last folder in the path, without delimiterslog
%PATH<2%Last two folders in the path, without leading or trailing delimitersweb\log
(...etc...)
%PATH<99%Last 99 folders in the path, without leading or trailing delimitersdata\files\web\log
%PATH-1%Path without the drive or the first folderfiles\web\log
%PATH-2%Path without the drive or the first two foldersweb\log
(...etc...)
%PATH-99%Path without the drive or the first 99 folders.(nothing)
%PATH<-1%Path without the drive or the last folderdata\files\web
%PATH<-2%Path without the drive or the last two foldersdata\files
(...etc...)
%PATH<-99%Path without the drive or the last 99 folders.(nothing)

Combining Path Placeholders

You can string several path placeholders together to form a complete path. If you have a file c:\data\test\file.txt then d:\%FOLDER2%\%FILENAME% will be substituted with d:\test\file.txt. However, if the original file is c:\more\file.txt then the same path will be replaced with d:\\file.txt because %FOLDER2% is empty. The result is an invalid path.

The solution is to use combined path placeholders, like this: d:\%FOLDER2\FILENAME%. The first example will be substituted with d:\test\file.txt just the same, and the second will be substituted with d:\file.txt, a valid path. You can combine any number of path placeholders into a single path placeholder, separating them either with backslashes (\) or forward slashes (/). Place the entire combined placeholder between two percentage signs.

A slash between two placeholders inside the combined placeholder is only added if there is actually something to separate inside the placeholder. Slashes between two placeholders will never cause a slash to be put at the start or the end of the entire resulting path. In the above example, the backslash inside the placeholder is only included in the final path if %FOLDER2% is not empty.

A slash right after the first percentage sign makes sure that the resulting path starts with a slash. If the entire resulting path is empty, or if it already starts with a slash, then the slash is not added.

A slash right before the final percentage sign makes sure that the resulting path ends with a slash. If the entire resulting path is empty, or if it already ends with a slash, then the slash is not added.

Mixing backslashes and forward slashes is not permitted. Using a forward slash inside a combined placeholder, will convert all backslashes in the resulting path to forward slashes. This is useful when creating URLs based on file names, as URLs use forward slashes, but Windows file names use backslashes.

Example: If the original path is c:\data\files\web\log\foo.bar.txt

PlaceholdersResulting path
%\FOLDER1\%\data\
%\FOLDER5\%(nothing)
%PATH-2\FILENAME%web\log\foo.bar.txt
%PATH-2/FILENAME%web/log/foo.bar.txt 
%PATH-4\FILENAME%foo.bar.txt
%DRIVE\PATH-2\FILENAME%c:\web\log\foo.bar.txt 
%DRIVE\PATH-4\FILENAME%c:\foo.bar.txt 
%\FOLDER1\FOLDER4\%\data\log\
%\FOLDER1\FOLDER5\%\data\

See Also

Search menu
Search|Prepare to Search
Match Placeholders