Renaming files on remote server

If you have a new question you’d like our support staff to post a response to, please visit our customer community, Data Security Insiders, to pose the question in our Discussion Boards. We have a thread “Ask Our Tech Experts” that our support team monitors on a regular basis, or you can start a new discussion where other GoAnywhere users and support staff can weigh in. Log in or create your new account at

If you need an immediate response, please create a support ticket or contact our support team by email at [email protected].
2 posts Page 1 of 1


Posts: 1
Joined: Wed Sep 19, 2018 10:04 am

Post by hatchet » Wed Sep 19, 2018 10:38 am

I wonder if someone could help me with this, I've been trying various options to get this to work and I either get a syntax error or the job executes but nothing is renamed.

I have a remote FTP server with files in "\myfolder" matching "M*.TXT".
There may be 1 file there at a given time, or multiple files.
I want to rename them all when the job executes to "R3*.TXT".
I don't care what the rest of the filename is, so the 'M' can be preserved or overwritten as long as the filename begins "R3"

This is what I currently have and executes without errors but nothing is renamed - I have test files in the correct location.
I have test files in place but I don't know if it's failing due to the naming syntax, the folder syntax or what.
Code: Select all
<ftp resourceId="Server" version="1.0">
			<rename searchPattern="M*.TXT" patternType="wildcard" replaceWith="R3*.TXT">
				<fileset dir="\myfolder">
						<include pattern="M*.TXT" />


Posts: 7
Joined: Thu Feb 16, 2017 11:03 am

Post by Support_Andy » Fri Sep 21, 2018 9:07 am
How to use the rename command on a FTP server
See attachment for associated images to steps below
Step by Step FTP instructions
(158.54 KiB) Downloaded 619 times
1. Start with a timestamp task

2. List the files on the FTP server that match the format to rename

3. Use a For Each Loop to Iterate over the new ${fileList} variable created from step 2

4. Rename using the Input Files Variable ${cur} and use Search Pattern of M*.txt and replace with R3*_${CurrentTimeMillis()}.txt

NOTE: The replace action will fail if a file with that name exists on the remote server. For this reason, the addition of the millisecond timestamp can overcome that limitation.

5. Folder contents before rename
"M9901.txt ","Mandy 9.txt", "M123.txt"
6. Folder contents after rename
"R399101_1537535252915.txt", "R3andy 9_1537535252949.txt", "R3123_1537535252888.txt"
2 posts Page 1 of 1