Error creating folder

Advertisement

ThomasMcA
Joined:
Posts:
2

Error creating folder

I've googled the heck out of my issue with no results. I've also enabled logging, but the error doesn't make sense.

I'm using Powershell in Win10 to automate SFTP uploads. My script uploads into 5 or 6 destination folders based on which source files exist. The problem is that some uploads fail with "error creating folder" even though I am only uploading a single file into an existing folder.

Here's my code:
Write-Host "About to upload $($file.FullName) into $($ToFolder)"
$transferResult = $session.PutFiles($($file.FullName), $ToFolder, $False, $transferOptions)
The Powershell console shows this:
About to upload Z:\Folder1\Staging\Folder2\19-04288_Attachment_MIA-6456144_Folder2 ST.pdf into /Parent/Folder2/In/
Upload of Z:\Folder1\Staging\Folder2\19-04288_Attachment_MIA-6456144_Folder2 ST.pdf failed: Error creating folder '/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf/'.
Permission denied.
Error code: 3
Error message from server (en): Permission denied
The session log shows this:
> 2020-02-13 15:04:09.550 Script: put  -nopermissions -preservetime -transfer="binary" -resumesupport="off" -- "Z:\Folder1\Staging\Folder2\19-04288_Attachment_MIA-6456144_Folder2 ST.pdf" "/Parent/Folder2/In/"
. 2020-02-13 15:04:09.551 Copying 1 files/directories to remote directory "/Parent/Folder2/In/" - total size: 63,606
. 2020-02-13 15:04:09.551   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: N (102400); CalcS: No; Mask: 
. 2020-02-13 15:04:09.551   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2020-02-13 15:04:09.551   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2020-02-13 15:04:09.551 Getting real path for '/Parent/Folder2/In/'
> 2020-02-13 15:04:09.551 Type: SSH_FXP_REALPATH, Size: 36, Number: 42512
< 2020-02-13 15:04:09.558 Type: SSH_FXP_NAME, Size: 73, Number: 42512
. 2020-02-13 15:04:09.558 Real path is '/Parent/Folder2/In'
. 2020-02-13 15:04:09.559 File: 'Z:\Folder1\Staging\Folder2\19-04288_Attachment_MIA-6456144_Folder2 ST.pdf' [2020-02-13T19:41:09.244Z] [63606]
. 2020-02-13 15:04:09.559 Listing file "/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf".
> 2020-02-13 15:04:09.559 Type: SSH_FXP_LSTAT, Size: 80, Number: 42759
< 2020-02-13 15:04:09.567 Type: SSH_FXP_STATUS, Size: 33, Number: 42759
< 2020-02-13 15:04:09.567 Status code: 2, Message: 42759, Server: File not found, Language: en 
. 2020-02-13 15:04:09.567 Creating directory "/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf/".
. 2020-02-13 15:04:09.567 Canonifying: "/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf/"
. 2020-02-13 15:04:09.567 Getting real path for '/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf/'
> 2020-02-13 15:04:09.567 Type: SSH_FXP_REALPATH, Size: 81, Number: 43280
< 2020-02-13 15:04:09.573 Type: SSH_FXP_STATUS, Size: 33, Number: 43280
< 2020-02-13 15:04:09.573 Status code: 2, Message: 43280, Server: File not found, Language: en 
. 2020-02-13 15:04:09.574 Getting real path for '/Parent/Folder2/In/'
> 2020-02-13 15:04:09.574 Type: SSH_FXP_REALPATH, Size: 36, Number: 43536
< 2020-02-13 15:04:09.580 Type: SSH_FXP_NAME, Size: 73, Number: 43536
. 2020-02-13 15:04:09.580 Real path is '/Parent/Folder2/In'
. 2020-02-13 15:04:09.580 Canonified: "/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf"
> 2020-02-13 15:04:09.580 Type: SSH_FXP_MKDIR, Size: 84, Number: 43022
< 2020-02-13 15:04:09.587 Type: SSH_FXP_STATUS, Size: 36, Number: 43022
< 2020-02-13 15:04:09.587 Status code: 3, Message: 43022, Server: Permission denied, Language: en 
. 2020-02-13 15:04:09.587 Asking user:
. 2020-02-13 15:04:09.587 Error creating folder '/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf/'. ("Permission denied.
. 2020-02-13 15:04:09.587 Error code: 3
. 2020-02-13 15:04:09.587 Error message from server (en): Permission denied")
< 2020-02-13 15:04:09.587 Script: Error creating folder '/Parent/Folder2/In/19-04288_Attachment_MIA-6456144_Folder2 ST.pdf/'.
< 2020-02-13 15:04:09.588 Script: Permission denied.
< 2020-02-13 15:04:09.588 Error code: 3
< 2020-02-13 15:04:09.588 Error message from server (en): Permission denied

So, why am I getting "Error creating folder" when I'm uploading individual files into folders that already exist?

Reply with quote

Advertisement

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

Re: Error creating folder

Thanks for your report.
I have sent you an email with a debug version of WinSCP to the address you have used to register on this forum.

Reply with quote

Advertisement

You can post new topics in this forum