Thank you for all your help Martin, I finally got the files to rename!
The last thing I'm trying to do now is create a copy/backup before renaming the files. The files are located in my
folder and I want to copy them into my
folder. However, I am having trouble getting the files to copy.
I'm trying to use the following code (it's also the first line within my
loop); but it doesn't seem to work:
Copy-Item $fileinfo.FullName -Destination "//chroothome/xxxx/ftproot/Kevin-Test/draft"
and I get the following error:
copy-item : Cannot find path '//chroothome/xxxx/ftproot/Kevin-Test/Snfhc_users.080517090840.txt' because it does not exist.
At C:\Users\kdang\Desktop\File rename.ps1:33 char:13
+ copy-item $BackupFile -Destination "//chroothome/xxxx ...
+ CategoryInfo : ObjectNotFound: (//chroothome/sn...80517090840.txt:String) [Copy-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand
It seems like it's trying to search on my local computer, but I need it to search on the server. Am I targeting the file on the server incorrectly? For example: how would I target the file
within my session? Also, is (PowerShell)
the correct command to use?
Thank you in advance,