1. Matt Kluzak
  2. PowerBuilder
  3. Friday, 7 January 2022 15:10 PM UTC

I have an application that uses FileMove() on PDFs. The starting directory may vary, but the in the destination directory is always under the same main folder. At the main destination folder I have read permissions setup for a group that are applied to all files and folders below. I have been running into an issue where sometimes just this read permission is not getting applied. I have had the user who usually moves the files via the application try to directly move the file from one directory to another and the permissions apply as expected.

Is there another method to move the files or something I can call to have the permissions reapplied after the move?


Matt Kluzak Accepted Answer Pending Moderation
  1. Wednesday, 12 January 2022 21:52 PM UTC
  2. PowerBuilder
  3. # 1

After further testing, I discovered the issue is actually just moving the file. NTFS permissions, by default, apply differently when copying a file over versus moving it.

  1. Miguel Leeuwe
  2. Wednesday, 12 January 2022 22:59 PM UTC
So if you first copy to destination and delete the origin it works?

  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 12 January 2022 23:00 PM UTC
Never mind, You resolved the question, so I guess it does work :)
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 7 January 2022 18:35 PM UTC
  2. PowerBuilder
  3. # 2

Does the user who causes the problem maybe have a different mapping than other users, to get to the main folder? That could be the cause of the problem.

Then of course, you could try running this powershell script ("\\R9N2WRN\Share" is the main folder in this example). Personally I'm not a fan of that, since not everyone allows you to run powershell and it could be locked out on certain machines for certain users:

$Acl = Get-Acl "\\R9N2WRN\Share"

$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule("user", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")

Set-Acl "\\R9N2WRN\Share" $Acl

See https://stackoverflow.com/questions/25779423/powershell-to-set-folder-permissions

To execute powershell code from powerbuilder, see: https://stackoverflow.com/questions/54866589/run-powershell-commands-from-powerbuilder One user suggests using OLE instead of running a batch file with the Run() function (my preferred way too):

string ls_cmd
oleobject wsh
wsh=create oleobject


ls_cmd='cmd /C powershell ......'

destroy wsh


There's also a link to one of Bruce Armstrong's posts. He also uses "Run(...)", but suggests you can avoid that by using "ShellExec", "ShellExecEx" and "CreateProcess". 



There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 7 January 2022 16:16 PM UTC
  2. PowerBuilder
  3. # 3

Hi Matt;

  If all you do is just restart your PB App, do the PDF moves start working OK again?

Regards ... Chris

There are no comments made yet.
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Friday, 7 January 2022 16:12 PM UTC
  2. PowerBuilder
  3. # 4

Hi Matt

Are you saying that it works some of the time but not always?

There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.