Topic "Help::Move Latest(Todays) .dat File between folders on SFTP."

Author Message
Vk

Guest


Hi EveryOne,
I am a SSIS Developer. I am creating a package which connects to a SFTP Server, for that I am using WINSCP with Stored Session, and accomplishes the below 2 Tasks.

1. get the latest.dat file (i.e. Todays date) from Home/XXX/latest.dat (SFTP Server) to my local directory D:\XXX\latest.dat and
2. I have to rename the file from latest.dat to latest.log and move the file to a Home/XXX/log/ folder on the remote server (i.e SFTP Server).

can somebody please help me with this.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Please read documentation. If that does not help, come back.
_________________
Martin Prikryl
Vk

Guest


Hi prikryl
Thanks for your reply. Actually I am able to create a batch file with date and time stamp using a script task in my SSIS Package. And In that batch File my commands are::

CD PPP
get ABC_20100331.dat
mv ABC_20100331.dat ABC_20100330.ack /XXX/Ack/
(Rename file by changing extension and move to ACK folder)

mv ABC_20100331.dat /XXX/Processed/

mv ABC_20100331.dat ABC_20100330.log /XXX/Log/
(Rename file by changing extension and move to LOG folder)


I tried till get command, Its working fine. I am able to bring the file which I wanted. The only thing is the next 3 steps. I jus wanna make sure that the 3 move commands as said above will work fine while moving the files between folders after renaming them. I cant check them because the SFTP server is the Production server. Please confirm me that these 3 move comands are correct or not? If not please suggest me some Ideas on this.

Thanks In Advance
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Vk wrote:
mv ABC_20100331.dat ABC_20100330.ack /XXX/Ack/

Possibly you wanted to do:
mv ABC_20100331.dat /XXX/Ack/ABC_20100330.ack

Also you cannot move the same file again, as it is not there anymore.
_________________
Martin Prikryl
Vk

Guest


Hi prikryl

Thanks for your valuable suggestion. I was waiting for your reply. that really helped me. One final question prikryl. Since you told that I cannot use the same file agian in my further steps, Can I use a Copy command to do my required Task?
I mean can I use these following steps shown below::

cp ABC_20100331.dat ABC_20100330.ack
mv ABC_20100330.ack /XXX/Ack/ABC_20100330.ack


cp ABC_20100331.dat ABC_20100330.log
mv ABC_20100330.log /XXX/log/ABC_20100330.log

mv ABC_20100331.dat /XXX/Processed/ABC_20100330.dat

If not can you please suggest me another alternative approach for my task.

Thanks in Advance.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
You cannot duplicate remote file from script. All you can do is to download it and upload back to a different path.
_________________
Martin Prikryl
Advertisements

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License