S
Steven Burn
Okay, here's what I'm trying to do;
I have 3 folders in the root of my site;
/upg - contains upgraded file's
/folder1 (contains 500+ sub-folders)
/folder 2 (contains 300+ sub-folders (increasing daily))
Now, what I'm wanting to do is copy the files from the "upg" folder, to
every sub-folder in "folder1" and "folder2". I wrote the code below to
acheive this, but for some reason, it's additionally copying all of the
folders from the first folder, to the second (i.e. the contents of folder1
to folder2..... which it is not supposed to be doing).
'// Begin
<%
'// How this works;
'//
'// 1. Run script once to copy file's to folder1's sub-folders
'// 2. Change: set flds = fso.getfolder(server.mappath("folder1"))
'// to: set flds = fso.getfolder(server.mappath("folder2"))
'// 3. Run again to copy file's to folder2's sub-folders
'// shouldn't really be necessary but it keeps erroring if there's no
timeout specified.
server.scripttimeout = "5000"
dim fso
set fso = createobject("scripting.filesystemobject")
'// Set to folder1, is changed to folder2 when folder1 is complete
set flds = fso.getfolder(server.mappath("folder1"))
for each fld in flds.subfolders
fso.Copyfolder Server.MapPath("upg\"), fld.path, true
next
set fso = nothing
set flds = nothing
set fld = nothing
response.write "Done"
%>
'// End
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
Personal favourites
Practically Nerded - http://mvps.org/PracticallyNerded/
Bugs, Glitches n stuff - http://mvps.org/inetexplorer/Darnit.htm
Calendar of Updates - http://www.dozleng.com/updates/index.php?&act=calendar
I have 3 folders in the root of my site;
/upg - contains upgraded file's
/folder1 (contains 500+ sub-folders)
/folder 2 (contains 300+ sub-folders (increasing daily))
Now, what I'm wanting to do is copy the files from the "upg" folder, to
every sub-folder in "folder1" and "folder2". I wrote the code below to
acheive this, but for some reason, it's additionally copying all of the
folders from the first folder, to the second (i.e. the contents of folder1
to folder2..... which it is not supposed to be doing).
'// Begin
<%
'// How this works;
'//
'// 1. Run script once to copy file's to folder1's sub-folders
'// 2. Change: set flds = fso.getfolder(server.mappath("folder1"))
'// to: set flds = fso.getfolder(server.mappath("folder2"))
'// 3. Run again to copy file's to folder2's sub-folders
'// shouldn't really be necessary but it keeps erroring if there's no
timeout specified.
server.scripttimeout = "5000"
dim fso
set fso = createobject("scripting.filesystemobject")
'// Set to folder1, is changed to folder2 when folder1 is complete
set flds = fso.getfolder(server.mappath("folder1"))
for each fld in flds.subfolders
fso.Copyfolder Server.MapPath("upg\"), fld.path, true
next
set fso = nothing
set flds = nothing
set fld = nothing
response.write "Done"
%>
'// End
--
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
Personal favourites
Practically Nerded - http://mvps.org/PracticallyNerded/
Bugs, Glitches n stuff - http://mvps.org/inetexplorer/Darnit.htm
Calendar of Updates - http://www.dozleng.com/updates/index.php?&act=calendar