# Windows Powershell Script Help - Slight Tweak

**URL:** https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867
**Category:** PowerShell Help
**Created:** [June 19, 2017, 11:12am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867 "2017-06-19T11:12:30Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)
#### Post date: [June 19, 2017, 11:12am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/1 "2017-06-19T11:12:30Z")

</div>

Hello,

I would be grateful if someone could help me with my issue. I have got a powershell script which downloads files from a SFTP folder into a local folder on my computer and then the file is deleted. It works fine. However, I want it to download into two local folders and then for the file to be deleted. Can anyone please assist me with this. Here is the current code below, just want to add an additional local path:

_ **Removed code at the request of the user.** _ - WA

Thanks in advance!

---

<div class="post-metadata">

### Author: ![dirk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/dirk/32/475_2.png) [@dirk](https://forums.powershell.org/u/dirk)
#### Post date: [June 19, 2017, 2:36pm UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/2 "2017-06-19T14:36:28Z")

</div>

Hi,

this should do the trick (just pasting the relevant parts):

```
$localPaths = 'c:\folder1\', 'c:\folder2\'
# Synchronize files to local directory, collect results
foreach ($localPath in $localPaths){
    $synchronizationResult = $session.SynchronizeDirectories(
    [WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $False)
}
```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)
#### Post date: [June 20, 2017, 7:36am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/3 "2017-06-20T07:36:10Z")

</div>

Hello,

Thanks so much for your response, I am very grateful for this. However, it does not work. This is the code I amended it too, please help. This is the image of the error:

Removed code at OPs request - WA

---

<div class="post-metadata">

### Author: ![dirk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/dirk/32/475_2.png) [@dirk](https://forums.powershell.org/u/dirk)
#### Post date: [June 21, 2017, 12:19am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/4 "2017-06-21T00:19:32Z")

</div>

Hi,

I don’t see the error message. Without it, it’s pretty hard to tell what is wrong.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)
#### Post date: [June 22, 2017, 10:28am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/5 "2017-06-22T10:28:12Z")

</div>

Hello,

Thanks for your response, apologies I never saw it. Let me try again, see link below for screenshot:

> **[2017-06-22\_1656](https://www.screencast.com/t/bCEoTBXJP4f4)**
>
> Shared from Screencast.com

I look forward to your response.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)
#### Post date: [June 23, 2017, 5:11am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/6 "2017-06-23T05:11:35Z")

</div>

Any help would be greatly appreciated.

Thanks so much.

---

<div class="post-metadata">

### Author: ![dirk](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/dirk/32/475_2.png) [@dirk](https://forums.powershell.org/u/dirk)
#### Post date: [June 23, 2017, 7:42am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/7 "2017-06-23T07:42:38Z")

</div>

Ok, you’ll need to put the paths into parenthesis, since it is used as an argument for a parameter in your script:

```
$localPaths = ('c:\folder1\', 'c:\folder2\')
```

---

<div class="post-metadata">

### Author: ![veergudka](https://avatars.discourse-cdn.com/v4/letter/v/22d042/32.png) [@veergudka](https://forums.powershell.org/u/veergudka)
#### Post date: [August 3, 2017, 10:26am UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/8 "2017-08-03T10:26:17Z")

</div>

Moderator can this thread please be removed as a matter of urgency, the first post contains some personal information.

---

<div class="post-metadata">

### Author: ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)
#### Post date: [May 16, 2024, 8:37pm UTC](https://forums.powershell.org/t/windows-powershell-script-help-slight-tweak/8867/9 "2024-05-16T20:37:46Z")

</div>


