Topic "Adding a Prefix to a Filename Using Operation Masks"

Author Message
[View user's profile]

Joined: 2009-10-16
Posts: 1
Location: Seattle WA
I am trying to use the masks into to rename each file on the local machine such that they are prefixed with a string.

I have a terribly simple script which uses the get command to copy all files with a txt.gz extension that are in each of the directories of the remote machine (that start with a numeric), into a local directory.


option include "[1-9]*/; *.txt.gz"
get * C:\feeds\companyA

remote machine directory & name local machine directory & name
1dir/12113.txt.gz C:\feeds\companyA\12113.txt.gz
2dir/55225.txt.gz C:\feeds\companyA\55225.txt.gz

This works great. However, what I would like is for the local file names to be prefixed with a string,
e.g. C:\feeds\companyA\sample12113.txt.gz.

I have tried many different ways, but all end up either chopping off some of the numbers in the filename, or creating subdirectories I don't need.

Obviously, I could just do this with a shell script, but I would love to do it in this one command. Is this possible?
I can provide examples of what I have attempted if it would help.

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
No, it is not possible.
Martin Prikryl

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License