Winscp Script to Rename a File to Append Timestamp

Based on a link from Stackoverflow by WinSCP author Martin Prikryl:
The put command accepts an optional second argument to specify a target name.
put localfile remotefile

Here is an example I used:

winscp.StandardInput.WriteLine(“put E:\\myfolder\\myfile.csv myfile” + DateTime.Now.ToString(“_MMddyyyy_HHmm”) + “.csv”);
The local file name is myfile.csv and the remote file name changed to

//Based on WinSCP site forum, Martin suggested: mv command should work as well
//winscp.StandardInput.WriteLine(“mv myfile.csv myfile”+ DateTime.Now.ToString(“_MMddyyyy_HHmm”) + “.csv”);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s