FTP Rename wildcard

I need help regarding file rename over FTP. I have multiple files with extension as *.pdf, and I want to rename all these files to *.old. Any help is appreciated. Thank you.
1 REPLY

Re: FTP Rename wildcard

On most FTP servers, you can't do anything like "rename *pdf *old", you have to rename the files one at a time
The documentation (5.1.1) says "tFTPRename renames files selected from a local directory towards a distant FTP directory." That makes is sound to me like tFtpRename doesn't rename files taht are already on an ftp server, but that sounds crazy, I expect the documentation is wrong. This post: http://www.talendforge.org/forum/viewtopic.php?id=12675 implies that the file doesn't have to be a local one to start.
Here's what I would expect to work - I don't have an FTP site to practice on:
1. get a list of .pdf files with tftpFileList
2. connect that with iterate to tFtpRename
3. put tFtpFileList_1_CURRENT_FILEPATH tFtpFileList_1_CURRENT_FILE in as the "Filemask"*
4. put the same thing, followed by .replaceAll("pdf$", "old")
3 will really look like globalMap.get("...FILEPATH") globalMap.get(..."FILE"). You can drag-and-drop those from the "Outline" when you expand the tFtpFileList component.
In steap 4, replaceAll looks for a regular expression - and $ means "end of the string" - so pdf will match only one thing, and replace it wil old. Your filemask on tFTPFileList will ensure that the file ends with .pdf. If the files can be upper lower cse, .replaceAll("$")