INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

FileSystemObject fails with Permission Denied error on creation of second file

FileSystemObject fails with Permission Denied error on creation of second file

FileSystemObject fails with Permission Denied error on creation of second file

(OP)
My application fails after creating the first directory, then copying a file into to it, then creating another directory and trying to copy another file into it.

I have tried with 2 files in the first diretory and again it fails on the second file.

Really not sure why it's failing, but here is the code and console output
for x = 0 to ubound(ftpinvoices,2)-2
	set fs=Server.CreateObject("Scripting.FileSystemObject")
	If Not fs.FolderExists(temp_folder&"\ftpfiles\Weekending-" & isodate(nextupload,true)&"\"& replace(bu," ","-")&"\") then
		set f=fs.CreateFolder(temp_folder&"\ftpfiles\Weekending-" & isodate(nextupload,true)&"\"& replace(bu," ","-")&"\")
		f.Attributes = 0
	end if
	do while  bu = mid(ftpinvoices(0,x),39,instr(39,ftpinvoices(0,x),"\",0)-39)
		invoice = ftpinvoices(0,x)&ftpinvoices(1,x)
		fromfile = invoice
		response.write("from="&fromfile&VbCrLf)
		tofile = temp_folder&"\ftpfiles\Weekending-" & isodate(nextupload,true)&"\"& replace(bu," ","-")&"\"
		response.write("to="&tofile&VbCrLf)
		fs.CopyFile fromfile,tofile,True	
		objTextFile.WriteLine "put " & chr(34)&invoice&chr(34)
		x=x+1
		if x > ubound(ftpinvoices,2)-2 then
			exit do
		end if	 
	loop
	bu = mid(ftpinvoices(0,x),39,instr(39,ftpinvoices(0,x),"\",0)-39)
	set fs=nothing
next 

And the console output

from=C:\Users\me\Google Drive\Invoicing\DUCK-Duck-n-Roll\Flourish\INV-2014-11-09-44529-po-DUCK00216.pdf
to=C:\inetpub\wwwroot\office.mysite.com\ftpfiles\Weekending-2014-11-16\DUCK-Duck-n-Rollfrom=C:\Users\me\Google Drive\Invoicing\HOLACG-Covent Garden\Brakes\Inv-2014-11-15-9224697868-po-HPCG04.pdf
to=C:\inetpub\wwwroot\office.mysite.com\ftpfiles\Weekending-2014-11-16\HOLACG-Covent-Garden <font face="Arial" size=2>
<p>Microsoft VBScript runtime </font> <font face="Arial" size=2>error '800a0046'</font>
<p>
<font face="Arial" size=2>Permission denied</font>
<p>
<font face="Arial" size=2>/doshiweekly.asp</font><font face="Arial" size=2>, line 265</font> 
 

The code is selection files with particular date ranges and copying them to another directory.

I cannot see why it would create a directory and copy a file into to it, then create the second directory and fail copying the next file. I have checked all the permissions of the source files, and the target directory, and everything looks fine.

Any help greatly welcome.

Pete

RE: FileSystemObject fails with Permission Denied error on creation of second file

Because it is not permissions, that is simply the first 'excuse' it came up with for that particular error.

First off eliminate the spaces in the paths, as they are always a source of contention in scripting. By either using different locations or wrapping the paths in quotes [chr(34)]



Second:
For deity's sake please use TGML code delimiters when posting code snippets [ instructions on how to do that can be found by clicking on the 'help' icon adjacent to the [ preview ] button

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: FileSystemObject fails with Permission Denied error on creation of second file

(OP)
Thanks Chris,

There are no spaces in the 'to' file name, and the Google Drive name is not assigned by me. I will try putting quotes around it, but it worked the first time through.

I missed the CODE button, and will make sure I use it in future.

Regards
Pete

RE: FileSystemObject fails with Permission Denied error on creation of second file

(OP)
I get another error when surrounding by quotes!

CODE -->

from="C:\Users\pzh20\Google Drive\Invoicing\DUCK-Duck-n-Roll\Flourish\INV-2014-11-09-44529-po-DUCK00216.pdf"
to=C:\inetpub\wwwroot\office.lemarcheduquartier.com\ftpfiles\Weekending-2014-11-16\DUCK-Duck-n-Roll <font face="Arial" size=2>
<p>Microsoft VBScript runtime </font> <font face="Arial" size=2>error '800a0034'</font>
<p>
<font face="Arial" size=2>Bad file name or number</font>
<p>
<font face="Arial" size=2>/doshiweekly.asp</font><font face="Arial" size=2>, line 265</font> 

Regards
Pete

RE: FileSystemObject fails with Permission Denied error on creation of second file

The combination of those errors suggests that you need to terminate your path with a "\"

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: FileSystemObject fails with Permission Denied error on creation of second file

(OP)

Nope!

CODE -->

from="C:\Users\me\Google Drive\Invoicing\DUCK-Duck-n-Roll\Flourish\INV-2014-11-09-44529-po-DUCK00216.pdf"
to=C:\inetpub\wwwroot\office.mysite.com\ftpfiles\Weekending-2014-11-16\DUCK-Duck-n-Roll <font face="Arial" size=2>
<p>Microsoft VBScript runtime </font> <font face="Arial" size=2>error '800a0034'</font>
<p>
<font face="Arial" size=2>Bad file name or number</font>
<p>
<font face="Arial" size=2>/doshiweekly.asp</font><font face="Arial" size=2>, line 265</font> 

Regards
Pete

RE: FileSystemObject fails with Permission Denied error on creation of second file

to=C:\inetpub\wwwroot\office.mysite.com\ftpfiles\Weekending-2014-11-16\DUCK-Duck-n-Roll <font face="Arial" size=2>

No trailing slash on that path.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: FileSystemObject fails with Permission Denied error on creation of second file

(OP)
Sorry, the cut and paste was wrong

CODE -->

from="C:\Users\me\Google Drive\Invoicing\DUCK-Duck-n-Roll\Flourish\INV-2014-11-09-44529-po-DUCK00216.pdf"
to=C:\inetpub\wwwroot\office.mysite.com\ftpfiles\Weekending-2014-11-16\DUCK-Duck-n-Roll <font face="Arial" size=2>
<p>Microsoft VBScript runtime </font> <font face="Arial" size=2>error '800a0034'</font>
<p>
<font face="Arial" size=2>Bad file name or number</font>
<p>
<font face="Arial" size=2>/doshiweekly.asp</font><font face="Arial" size=2>, line 265</font> 


Pete

RE: FileSystemObject fails with Permission Denied error on creation of second file

(OP)
The slash shows when I edit the post above, but after I submit it it disappears!

Pete

RE: FileSystemObject fails with Permission Denied error on creation of second file

(OP)
to=C:\inetpub\wwwroot\office.lemarcheduquartier.com\ftpfiles\Weekending-2014-11-16\DUCK-Duck-n-Roll\

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close