Blogs

TurboFTP Client: Automating File Renaming in FTP/SFTP Synchronization Without Coding

TurboFTP is a highly compact yet feature-rich managed file transfer solution, offering various automated processes for file synchronization across FTP or SFTP servers. One of its standout features is the ability to automate file renaming during the transfer process, all without requiring any coding. This article will guide you through setting up automatic file renaming during FTP or SFTP sync tasks. 

Scenario: Auto Rename in FTP/SFTP Synchronization

For example, you have already configured a sync task to upload new files to a remote SSH server, named PartnerSsh, every 10 minutes. Now, you want every file with a .txt extension to be automatically renamed to .csv. when uploaded to the remote server. 

Setting Up Built-in Auto Rename in TurboFTP

TurboFTP has a built-in auto-rename capability that can be customized for each site or server. TurboFTP makes it simple to enable auto-renaming during file transfers by applying rules globally or at an individual site level. Here's how to set it up:

  • Go to Global Options → Auto Rename tab and add a rule to rename files with a .txt extension to .csv (.txt → .csv).
  • Open the Address Book and navigate to your site settings for PartnerSsh. Under the Files tab, enable the option for Auto rename on upload.

Once these steps are complete, any file with a .txt extension that is uploaded to the remote server will be automatically renamed to .csv after the transfer is complete.

The Auto Rename rules have a global effect. Once enabled for a site profile, they apply to all file transfers (both uploads and downloads) within the GUI program and scheduled tasks.

More Generic Alternatives to Automated Renaming

In addition to TurboFTP's built-in feature, there are alternative methods for automating file renaming that can be used in conjunction with TurboFTP's task scheduler. These methods provide more flexibility for different scenarios. 

Pre-task Local Batch Rename

You can batch rename all local files before running a sync task by using a pre-task script. Here's how:

  • Create a BAT script to rename all .txt files to .csv.
  • Use the DOS ren command with wildcards, for example:
ren *.txt *.csv
  • Save this command in a batch file and specify its path in Task Settings → Before Task. This script will execute before the sync task starts, ensuring all local files are renamed before being uploaded.

Post-task Remote Rename (for SSH servers)

If you're connecting to an SSH server, you can rename files after a successful task execution using a post-task script. This method requires permission to run shell commands on the remote server.

In Task Settings → Advanced → After Task, under the R (remote) field, enter a command to rename all .txt files to .csv. For example:mmv "*.txt" "#1.csv"
The mmv command is used to batch rename files on Linux/Unix systems. Ensure the command is available on the remote server.

The R field accepts remote paths to Unix scripts, while the L field accepts local paths to DOS or PowerShell scripts.

This remote shell command option enables users to leverage the powerful collection of Linux utilities available for managing files. This method also allows for more complex renaming and file management operations that might not be possible with the built-in functionality of TurboFTP.

Conclusion

TurboFTP's auto rename feature provides a seamless way to automate file renaming during file synchronization tasks, whether for FTP or SFTP transfers. For more flexibility, pre- or post-task scripts can be integrated into your sync workflow to handle more advanced renaming needs.

By utilizing these tools, file management processes can be significantly simplified, improving efficiency and reducing the need for manual intervention during file transfers.

×
Stay Informed

When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.

Setting up TurboFTP Server WebUI for Office Collab...

Related Posts