Modifying Powershell script

SR Zak
SR Zak used Ask the Experts™
Hi Experts,

I have this PowerShell script but I just want to change the Local Directory (C:/Dir) to a network share lets say \\share\docs\*.* , also I want to make sure the files from the local share folder docs  are copied and are uploaded to the FTP site.  Below is the script, please let me know

#we specify the directory where all files that we want to upload  
#ftp server
$ftp = "
$user = "user"
$pass = "Pass"  
$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($user,$pass)  
#list every sql server trace file
foreach($item in (dir $Dir "*.trc")){
    "Uploading $item..."
    $uri = New-Object System.Uri($ftp+$item.Name)
    $webclient.UploadFile($uri, $item.FullName)
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
 Change the hard coded c:\dir to \\servername\sharename\  add the directory if needed.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial