FileSystemObject: Permission denied??

  • Thread starter Vilmar Brazão de Oliveira
  • Start date
V

Vilmar Brazão de Oliveira

Hi,
I got the err below, nevertheless my folders have full permissions for all.

Permission denied
/vilmar/ASP_JavaScript_CSS_HTML/ajudas_asp_completos/novo_asp/novo_asp_4-12-
03/Objeto_FileSystemObject.asp, line 17

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set Arquivo = objFSO.CreateTextFile("c:\Texto_teste.txt", True)
Arquivo.WriteLine("Isto é um texto." & vbcrlf & "Outra linha do texto e " &
vbcrlf & "....outra linha do texto.")
Arquivo.Close
Set Arquivo = objFSO.GetFile("c:\Texto_teste.txt")
Arquivo.Move "D:\Testes_Apostilas" ' »»line 17

Thanks,

««««««««»»»»»»»»»»»»»»
Vlmar Brazão de Oliveira
Desenvolvimento Web
HI-TEC
 
A

Aaron Bertrand - MVP

IUSR_MachineName is unlikely to have permissions to read/write to c:\ or
d:\, and probably for good reason. Why not create the file in the web
structure, e.g.

Set Arquivo = objFSO.CreateTextFile(Server.MapPath("Texto_teste.txt"), True)
 
P

Phill. W

.. . .
Set Arquivo = objFSO.GetFile("c:\Texto_teste.txt")
Arquivo.Move "D:\Testes_Apostilas" ' »»line 17

To move a File into a Directory, I think that should be

Arquivo.Move "D:\Testes_Apostilas\"

HTH,
Phill W.
 
A

Aaron Bertrand - MVP

Arquivo.Move "D:\Testes_Apostilas" ' »»line 17

In addition to my other comment, I believe you need a source and a
destination with the Move command. I also have always used FSO for this,
rather than grabbing an additionl file handle.

objFSO.movefile "c:\Texto_teste.txt", "d:\Testes_Apostilas\Texto_teste.txt"

However, as I stated before, why are you putting these things on the roots
of hard-coded drives? And why create and then move... why not just create
it where you want it?
 
V

Vilmar Brazão de Oliveira

Thank you Phill and others,
I had forgot the inverted bar \ »» Arquivo.Move "D:\Testes_Apostilas\"

Regards,
Vilmar
Brazil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top