This article mainly introduces the alternative method for insufficient permissions of the ASP move file function movefile. This article first introduces an alternative method, and then finds out the actual reason. Friends who need it can refer to it.
I am working on a project these days, which is to write a statement to move all the files on the D drive to the E drive. It is good to test it in the local XP environment.
However, after putting it on the Windows 2003 server, it prompts that the permissions are insufficient.
My IIS website directory is placed on the D drive, and the E drive is just a newly added volume. Some files are very large and there are many, but the D drive is not enough, so I came up with this strategy.
After searching on Baidu, many of these problems are nothing more than increasing the permissions of the E drive, or using the E drive as a virtual directory.
But it doesn't work, and it still reminds me. The only difference is that I use a dynamic volume, while under XP it is a basic volume. I don't want to change the volume.
Finally found the following method:
Using fso's movefile will cause insufficient permissions, so the code cannot be executed.
So use copyfile and then deletefile to avoid unnecessary trouble.
Right now:
Copy the code code as follows:
Set fso=CreateObject("scripting.filesystemobject")
fso.MoveFile "File path","target"
This will cause problems.
use:
Copy the code code as follows:
Set fso=CreateObject("scripting.filesystemobject")
fso.CopyFile "File Path","Target"
fso.DeleteFile "File path"
This decisively solved the problem. It can be copied but not moved.
4.30 update
After some tinkering, it turned out that it was not a problem with the permissions of the E drive, but a problem with the permissions of the D drive, that is, the problem of the IIS website directory permissions.
Add an Internet guest account to the D drive, that is, add an account starting with IUSR_. This account is an IIS account.
Then using MoveFile is no problem.
If you want to move or delete a file, the first thing you should check is the permissions of the source file, not the permissions of the target file.
Tutorials on the Internet are really harmful.