Forum Moderators: open

Message Too Old, No Replies

FileSystemObject

Moving,copying files

         

Andrew Thomas

3:46 pm on Mar 22, 2002 (gmt 0)

10+ Year Member



I need to move files around my system, im looking at the FileSystemObject to do this, the problem is all the examples ive found eg 'var objFSO;
objFSO = new ActiveXObject("Scripting.FileSystemObject");

objFSO.MoveFile("c:\\HowToDemoFile.txt", "c:\\Temp\\");
objFSO.CopyFile("c:\\Temp\\HowToDemoFile.txt", "c:\\");'

show how to copy the same 'named' text file each time.

I need a system which can handle different text names each time eg 123.txt 532.txt etc , any ideas on how to do this - i suppose they must come from a linked database first where are the named files will be held..

Im guessing i need variable to handle the different text files, but im getting confused.

any advice or samples will help

thanks

korkus2000

3:28 am on Mar 23, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



All you need to do If you are moving all of the files to the same directory is loop it. Inside the loop call the text name out of the database and populate a variable. If you need them to go to different directories then add a feild to the db that has the path. Populate the two arguments:
objFSO.MoveFile(FilePathVariable, MoveFileVariable);
objFSO.CopyFile(FilePathVariable, MoveFileVariable)
Keep reassigning the variables during the loop.

I hope thats your question.