Create Remote folder with Timestamp

Advertisement

kinetix
Joined:
Posts:
1

Create Remote folder with Timestamp

Hi all,
Please excuse me if my question cover some topics, but I can't find exactly my theme.
So, I want upload files in remote folder which is created with timestamp for everyday.

1) I have path /home/user
2) script which find on winscp example - works, but I tried to change.
3) I success to create remote folder with session.CreateDirectory

But, I can't change location on ftp side, after create directory.

I'm using powershell version 1, on windows 2003 server.

Upload scripts as attached file.

Thank you for your time.
Description: script upload ftp

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,392
Location:
Prague, Czechia

Re: Create Remote folder with Timestamp

You need to use absolute paths.

$stamp = $(Get-Date -f "ddMMyyyy")

#Trying create newfolder
$session.CreateDirectory(("/" + $stamp))

# Upload files, collect results
$transferResult = $session.PutFiles($localPath, ("/" + $stamp + "/*"))

Reply with quote

Advertisement

You can post new topics in this forum