473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MoveFile problem

Hi,
I want to move images from a folder to specific subfolders.
The script below generates the following error:
a.. Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required:'[undefined]'

<%
sub moveImagesToFolder(Folder)
dim fs,fo,x,text,Foldername,fm,f1
set fs=Server.CreateObject("Scripting.FileSystemObject ")
set fo=fs.GetFolder(Server.MapPath(Folder))
for each x in fo.files
text=Len(x.Name)-4
Foldername=Left(x.Name,text)
set f1 = fs.GetFile(x)

'/////here is where the error is targeted: don't know why!////
set fm=fs.MoveFile(f1,"C:\Inetpub\wwwroot\"&Folder&"\" &Foldername&"\")

set fm=nothing
set f1=nothing
next
set fs=nothing
set fo=nothing
end sub

%>

Can someone help?
Thx
Jul 22 '05 #1
2 2609
The .MoveFile method doesn't return an object. Also, the first argument is
to be a file path, not a file object.
fs.MoveFile path1, path2

Ray at work

"Patrice" <ma*****@videotron.ca> wrote in message
news:lM********************@weber.videotron.net...
Hi,
I want to move images from a folder to specific subfolders.
The script below generates the following error:
a.. Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required:'[undefined]'

<%
sub moveImagesToFolder(Folder)
dim fs,fo,x,text,Foldername,fm,f1
set fs=Server.CreateObject("Scripting.FileSystemObject ")
set fo=fs.GetFolder(Server.MapPath(Folder))
for each x in fo.files
text=Len(x.Name)-4
Foldername=Left(x.Name,text)
set f1 = fs.GetFile(x)

'/////here is where the error is targeted: don't know why!////
set fm=fs.MoveFile(f1,"C:\Inetpub\wwwroot\"&Folder&"\" &Foldername&"\")
set fm=nothing
set f1=nothing
next
set fs=nothing
set fo=nothing
end sub

%>

Can someone help?
Thx

Jul 22 '05 #2
verify all your values first. Make sure that they are all what you expect.
Write em out to the screen.
If that works try hardcoding a simple file with the objects you indicated,
see what happens.

Then combine the two....
Basic troubleshooting methodology.

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Patrice" <ma*****@videotron.ca> wrote in message
news:lM********************@weber.videotron.net...
Hi,
I want to move images from a folder to specific subfolders.
The script below generates the following error:
a.. Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required:'[undefined]'

<%
sub moveImagesToFolder(Folder)
dim fs,fo,x,text,Foldername,fm,f1
set fs=Server.CreateObject("Scripting.FileSystemObject ")
set fo=fs.GetFolder(Server.MapPath(Folder))
for each x in fo.files
text=Len(x.Name)-4
Foldername=Left(x.Name,text)
set f1 = fs.GetFile(x)

'/////here is where the error is targeted: don't know why!////
set
fm=fs.MoveFile(f1,"C:\Inetpub\wwwroot\"&Folder&"\" &Foldername&"\")

set fm=nothing
set f1=nothing
next
set fs=nothing
set fo=nothing
end sub

%>

Can someone help?
Thx

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

117
by: Peter Olcott | last post by:
www.halting-problem.com
1
by: Shelley | last post by:
Hi Everyone, Does anyone know what object it is in the MoveFile Method object.MoveFile source, destination in access? Any help will be highly appreciated!
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
0
by: RSH | last post by:
I have an ASP page that needs to move a file from one directory to another. The code is quite simple but I can't seem to get it to work. I keep getting a "Download Error: Procedure call or...
2
by: RSH | last post by:
I have an ASP page that needs to move a file from one directory to another. The code is quite simple but I can't seem to get it to work. I keep getting a "Download Error: Procedure call or...
6
by: Mat N | last post by:
Hello access friends, (Originally posted on access.formsprogramming which I think was the wrong place) I'm precalculating a bunch of data for my clients as per a profile I have for each of...
4
by: b00gieman | last post by:
Hello! I'm using the MoveFile method for moving files between 2 servers , one running my asp script and the other running my database.My problem is that I'm getting the error: Microsoft VBScript...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.