Syncronize Directories with Powershell - write log to file?

Advertisement

tredjejuni
Joined:
Posts:
2

Syncronize Directories with Powershell - write log to file?

Hi,

I have got this powershell script example to work really great!
https://winscp.net/eng/docs/library_session_synchronizedirectories#powershell

But I would like the output information in a file in stead of on the screen.

I have tried almost everything in Powershell but without success. Only the last file transfer is seen in the file if I use
Write-Output ("Download of {0} succeeded" -f $e.FileName) > C:\backuptest\log.txt

How can I get the full log into the file? Preferrably a new line for each message. :?:

Thanks for any advice![/code]

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Syncronize Directories with Powershell - write log to file?

To append to a file, instead of overwriting it, use >> instead of the >:

Write-Output ("Download of {0} succeeded" -f $e.FileName) >> C:\backuptest\log.txt

Reply with quote

tredjejuni
Joined:
Posts:
2

Re: Syncronize Directories with Powershell - write log to file?

martin wrote:

To append to a file, instead of overwriting it, use >> instead of the >:

Write-Output ("Download of {0} succeeded" -f $e.FileName) >> C:\backuptest\log.txt

Many Thanks!!! It worked great! :D

Reply with quote

Advertisement

You can post new topics in this forum