Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

KAC

Hello!

How i can use WINSCP and Powershell to this work:

Folder 1 has many folders (they names 10102014, 11102014, 12102014, 13102014 .....)

I need this folder to destination folder (folder 2)

But i need condition IF someone folder exist she do not copy to destination folder and if folder dos not exist she (folder) copy to destination ((
Guest

NEW NEW NEW!!!!

Sorry!!

I have many directories MY REAL EXEMPLE:

In folder CHINA (Every day automate created folders 09102014; 10102014; 11102014; 12102014; 13102014 folder name = date)

I need copy (SFTP) this folder and include files to folder RUSSIA (09102014; 10102014; 11102014; 12102014; 13102014 folder name = date)

THIS FOLDER (09102014; 10102014; 11102014; 12102014; 13102014) has some .txt files.

Somebody files in destination folder I deleted (it is need for work)

If i run my script again. Files when i delete in sorce folder appear again. I do not need this.

It is real doing?

Thank you very much!

Спасибо.
Спасибо@
Guest

Re: Copy Exist Directory

martin wrote:

I'm not sure if I understand your problem, maybe you want to use synchronization, see Session.SynchronizeDirectories:
https://winscp.net/eng/docs/library_session_synchronizedirectories


Hello! Thank you.

If i use synchronization method then : I have 2 directories (source and Destination) I have ten(10) .txt files in source folder. When i run Synchronize this ten(10) files copy to destination folder. I need change some one files in destinations folder. And if i run script again (method Synchronize) my files in destinations changes??? I do not need if my files Synchronize when i run script again.

It is real?
Kac

Copy Exist Directory

Hi!

Please help me.

My problem is: I need use Powershell and winscp, and copy directory and files in this directory. Ok. I can do it.
But if i copy 1 time to destination folder, all files updating. It is not good.

Example:

I copy
Server1\home\user\ (in this folder has many folders (folders name 08102014;09102014;10102014)
Server2 D:\CO\08102014;09102014;10102014\

How i can check exist folder on destination server or not exist? If exist do not getfile(copy) if not exist then run getfiles.

I know
if ($session.FileExists($remotePath))

but what need next?) I dont now. Sorry i have bad English.