Topic "Copy Exist Directory"

Author Message
Kac

Guest


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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
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
_________________
Martin Prikryl
Guest




prikryl 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?
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!

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

Guest


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 ((
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