Topic "Create Remote folder with Timestamp"

Author Message
kinetix
[View user's profile]

Joined: 2016-02-03
Posts: 1
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.
ps_script.txt (1.9 KB) [Download]

Description: script upload ftp

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
You need to use absolute paths.

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

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

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

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License