You can quickly send or get multiple files at once using local or remote pattern matching. You can also delete multiple remote files with pattern matching. The patterns are formed by including wildcard characters in the source pathnames. The exact syntax of the patterns depends on whether they are local or remote, and what operating systems are being used.
The local command shell parses wildcard characters before movedat sees them. Wildcards in the local path will be interpreted by the local shell. Wildcards in the remote path must be properly quoted or escaped so that they can be passed to the server.
The behavior of wildcards will vary depending on the local and remote systems. For example, Windows only supports wildcards in the base name of the file, not in the path name. You can test which files will match a remote pattern by using the -F option. You can disable remote wildcards by using the -g option.
* Star, Asterisk, Splat
This matches zero or more characters in a pathname component. For example, applying the pattern t*.txt to the following file list:
test1.txt t.txt myfile.txt twenty.dat tuesday.dat
would match test1.txt and t.txt, but not myfile.txt, not twenty.dat, and not tuesday.dat. The star wildcard is supported in both Windows and Unix.
? Question Mark
This matches exactly one character in a pathname component. For example, applying the pattern test?.txt the following file list:
test1.txt test17.txt test2.txt test3.dat
would match test1.txt and test2.txt, but not test17.txt and not test3.dat. The question mark wildcard is supported in both Windows and Unix.
This construct matches a range of single characters in a pathname component. For example, applying the pattern test[1-3].txt the following file list:
test1.txt test17.txt test2.txt test3.dat test4.txt
would match test1.txt and test2.txt, but not test17.txt, test3.dat, nor test4.txt. The bracket wildcard is not supported by Windows.
The server currently limits the results of remote wildcard matching to 8 megabytes. This may truncate your results if a pattern matches millions of files.
Upper vs. Lower Case
Windows and macOS allow file names to match if they differ only by the case of some letters. Most other unix filesystems require an exact case match. It is best to avoid using filenames that differ only by the case of some letters, and try to match case exactly.
When you are using wildcards to match local files for sending, the pattern must be parsed by your local command shell. But when you want to use wildcards to download or delete remote files, the local shell must pass the characters through unchanged so that the server can see them.
In unix, you can tell the shell to ignore wildcards either by enclosing the entire argument in quotes, or by preceding each wildcard with a backslash. For example:
movedat firstname.lastname@example.org:subdir/files\*.txt mydir
movedat "email@example.com:subdir/files*.txt" mydir
In Windows, you can escape wildcards by using quotes:
movedat "firstname.lastname@example.org:subdir/files*.txt" C:\mydir
If you are having trouble getting wildcard patterns to work ("no match" errors), make sure that your remote patterns are escaped according to the rules of your local shell.
Server Directory Traversal (Dot Dot)
The pseudo-files "." and ".." are not included in servedat's wildcard output.
Explicit use of ".." in the original pattern may cause unexpected results as servedat attempts to resolve those before wildcard processing and without regard to wildcard syntax.
On unix systems, wildcards and ".." can interact with symbolic links in unexpected ways. See the Known Issues chapter for an example.
The following Windows batch script uses the "-F" option to retrieve a list of remote files, then downloads each one and deletes the source only when the download succeeds.
FOR /F "delims=" %%A IN ('movedat.exe -F email@example.com:*') DO ( movedat.exe -y "firstname.lastname@example.org:%%A" . IF ERRORLEVEL 1 ( ECHO Skipping "%%A" due to errors. ) ELSE ( movedat.exe -x "email@example.com:%%A" ) )
Prior to running this script, it would be necessary to store the password in the encrypted password cache.
movedat.exe -A firstname.lastname@example.org: