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 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
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Peter Olcott |
last post by:
www.halting-problem.com
|
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!
|
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();...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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$) {
}
...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
| |