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.
Placeholder | Meaning | Example |
---|---|---|
The entire path plus filename to the file | C:\data\files\web\log\foo.bar.txt | |
The file name without path | foo.bar.txt | |
The file name without the extension | foo.bar | |
The file name cut off at the first dot | foo | |
The extension of the file name without the dot | txt | |
Everything in the file name after the first dot | bar.txt | |
The full path without trailing delimiter to the file | C:\data\files\web\log | |
The drive the file is on, without trailing delimiter | C: for drive letter paths; \\server for UNC paths | |
The full path without the drive and without leading or trailing delimiters | data\files\web\log | |
First folder in the path | data | |
Second folder in the path | files | |
(...etc...) | ||
99th folder in the path. | (nothing) | |
Last folder in the path | log | |
Second folder from the end in the path | web | |
(...etc...) | ||
99th folder from the end in the path. | (nothing) | |
First folder in the path, without delimiters | data | |
First two folders in the path, without leading or trailing delimiters | data\files | |
(...etc...) | ||
First 99 folders in the path, without leading or trailing delimiters | data\files\web\log | |
Last folder in the path, without delimiters | log | |
Last two folders in the path, without leading or trailing delimiters | web\log | |
(...etc...) | ||
Last 99 folders in the path, without leading or trailing delimiters | data\files\web\log | |
Path without the drive or the first folder | files\web\log | |
Path without the drive or the first two folders | web\log | |
(...etc...) | ||
Path without the drive or the first 99 folders. | (nothing) | |
Path without the drive or the last folder | data\files\web | |
Path without the drive or the last two folders | data\files | |
(...etc...) | ||
Path without the drive or the last 99 folders. | (nothing) |
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
Placeholders | Resulting path |
---|---|
\data\ | |
(nothing) | |
web\log\foo.bar.txt | |
web/log/foo.bar.txt | |
foo.bar.txt | |
c:\web\log\foo.bar.txt | |
c:\foo.bar.txt | |
\data\log\ | |
\data\ |