Move remote files in a loop

Advertisement

ahd262
Guest

Move remote files in a loop

Hi
on a daily basis i receive a number of zipped files in a remote folder
The number and the name of these files changed each day and they aren t known in advance
I need to move each of one into an appropriate folder

I m using SSIS and would like to know how in a loop to be able to read them and to move them

Thx for your help

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Move remote files in a loop

Do you want to iterate a list of remote files and move every file to a different remote folder based on some rules?

You need Session.ListDirectory and Session.MoveFile methods of WinSCP .NET assembly:
https://winscp.net/eng/docs/library
https://winscp.net/eng/docs/library_session_listdirectory
https://winscp.net/eng/docs/library_session_movefile
_________________
Martin Prikryl

Reply with quote

ahd262
Guest

PostRe: Move remote files in a loop

Hi
I would like to loop on each zip files in a source directory and move the unzipped content to the folder N
It means if i ve 3 zip files i ve to read and unzip 3 files and move the content resoectively to the folder 1, 2 then 3
The nuumber of files is not known in advance
Do u advise me to use Session.ListDirectory or a foreach loop container with SSIS ?
Thx

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: PostRe: Move remote files in a loop

Is the target folder local or remote?
_________________
Martin Prikryl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Do you want them to be extracted in-place on remote side (complicated, if possible at all) or download the archives, extract and upload the contents?
_________________
Martin Prikryl

Reply with quote

ahd262
Guest

No I would prefer to execute the process only in remote (faster)
For each file saved in source folder I have to :
mv to its specific folder
unzip it
and rename the unzipped files

Reply with quote

Advertisement

You can post new topics in this forum