FSO 删除文件/移动文件权限错误

发布于 2025-01-03 14:16:55 字数 805 浏览 0 评论 0原文

我正在尝试使用经典的 asp fso 删除/移动文件,但收到此错误:

Microsoft VBScript runtime error '800a0046'

Permission denied

该文件位于 c:\files\test\file.txt 中,最终我想移动它到 c:\archive\file.txt

我开始使用 Move 但出现错误。然后我将其分为复制删除。复制顺利,但在删除时仍然出现相同的错误。

我排除了 Delete 方法,因为我能够使用以下代码对“archive”文件夹中的文件使用 Delete

dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("C:\archive\file.txt")
f.Delete
set f=nothing
set fs=nothing

我还仔细检查了两个文件夹的权限它们与 IIS_IUSRS 完全相同:读取和执行、列出文件夹内容、读取、写入均被检查。我也尝试授予修改权限,但这没有什么区别。

最后,我检查了文件的属性,结果显示为 32(存档)。我也尝试过强制删除:

fso.DeleteFile FileName, true

I'm trying to delete/move a file using classic asp fso but I'm getting this error:

Microsoft VBScript runtime error '800a0046'

Permission denied

The file is located in c:\files\test\file.txt and ultimately I want to move it to c:\archive\file.txt

I started out with Move but I got the error. Then I split it up into Copy and Delete. The copying went fine but still the same error on Delete.

I ruled out the Delete method because I was able to use Delete on the file in the 'archive' folder using this code:

dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("C:\archive\file.txt")
f.Delete
set f=nothing
set fs=nothing

I also double-checked the permissions on both folders and they're exactly the same for IIS_IUSRS: Read&Execute, List folder contents, Read, Write are checked. I tried giving Modify rights as well but that made no difference.

Finally, I checked the file's attributes and it came back as 32 (Archive). I also tried to force the delete:

fso.DeleteFile FileName, true

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

揽清风入怀 2025-01-10 14:16:55

IIS_USRS 文件夹权限必须特别包括 Windows 中“高级”对话框中的“删除”。

IIS_USRS folder permissions had to specifically include 'Delete' from the 'Advanced' dialog in Windows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文