Saturday, February 25, 2012

problem copying files.

Hi all,
I have a folder called Attach which contains a subfolder folder each
userid. Everyone has full access to the the files in the Attach folder. But
the subfolders are private to each user. I need to write a sql stored
procedure to copy files from the subfolders into the Attach folder and
execute it as a Sql job.
I have been able to write a stored procedure that copies the files from
subfolders into the Attach folder using UNC path. I use the windows Copy
command in the xp_cmdshell procedure. But the problem is that the File
Permissions also get copied along with the files. So the files remain
private to the user even though they are copied into the attach folder. Is
there anyway I can inherit the permissions from the Attach folder when I
copy the files into the Attach folder.
Thanks.Are you sure you're using "Copy" and not moving the file? When you copy the
file will inherit ACLs from the containing folder, when you move a file to a
new location on the same volumn the file retains its ACL permissions. Double
check that you are performing a copy. If you do need to move this file, stil
l
do a copy and then just delete the old one.
Cheers,
Steve Goodyear
Vancouver, Canada
"sql" wrote:

> Hi all,
> I have a folder called Attach which contains a subfolder folder each
> userid. Everyone has full access to the the files in the Attach folder. Bu
t
> the subfolders are private to each user. I need to write a sql stored
> procedure to copy files from the subfolders into the Attach folder and
> execute it as a Sql job.
> I have been able to write a stored procedure that copies the files from
> subfolders into the Attach folder using UNC path. I use the windows Copy
> command in the xp_cmdshell procedure. But the problem is that the File
> Permissions also get copied along with the files. So the files remain
> private to the user even though they are copied into the attach folder. Is
> there anyway I can inherit the permissions from the Attach folder when I
> copy the files into the Attach folder.
> Thanks.
>
>|||Thanks Steve.
I was using Move. But we had the same problem. So I changed the procedure
few days back to copy and delete the files and it appeared to be working
fine for the users we were using in our test. But now it seems to be working
well for some users but not all.
Thanks.
"Steve Goodyear" <SteveGoodyear@.discussions.microsoft.com> wrote in message
news:5773C1E5-6F9A-43C7-B910-C3BCEE9865C9@.microsoft.com...
> Are you sure you're using "Copy" and not moving the file? When you copy
the
> file will inherit ACLs from the containing folder, when you move a file to
a
> new location on the same volumn the file retains its ACL permissions.
Double
> check that you are performing a copy. If you do need to move this file,
still
> do a copy and then just delete the old one.
> Cheers,
> Steve Goodyear
> Vancouver, Canada
> "sql" wrote:
>
But
from
Is

No comments:

Post a Comment