Renaming file after downloading with today's date?

Advertisement

Mikedu
Guest

Renaming file after downloading with today's date?

Hi, I am using WinSCP for SFTP and it is working beautifully. I reference a txt file (see code below) and I call if from an SSIS package. The last thing I want to do is rename the source file to filename_todaysdate.txt. I have tried %date% but it just puts %date% in the filename, not the actual date. Any suggestions would be appreciated...

# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open login:pwd@IPAddress:Port
# Change remote directory
cd /home/emppfu/downloads
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get CDS_STAGE.txt "\\Entp14\empgroup\BSG\CDS Balancing\ToBeProcessed\"
# Disconnect
close
# Exit
exit

Reply with quote

Advertisement

mikedu
Guest

Do you refer to the .js file when running it from SSIS?

I called it from my execute process task in ssis and it gave me a ton of errors...sorry I am a newbie to this...

I referenced the .txt file in the arguments line, so I replaced it with the example file (see below)

Executable: C:\Program Files\WinSCP\WinSCP.com
Arguments: -script=C:\download.js
Working directory: C:\Program Files\WinSCP

Reply with quote

mikedu
Guest

I added another line

just trying to rename the file with today's date using script commands and it didn't work.

mv CDS_STAGE.txt %date:~4,2%-%date:~7,2%-%date:~10,4%.txt

Reply with quote

Advertisement

You can post new topics in this forum