If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > vb script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-31-03, 09:50
jamesholyoak jamesholyoak is offline
Registered User
 
Join Date: Mar 2003
Posts: 1
vb script

i am trying to create a vb script for a application that will copy and move files from one drive to another. The script will move a file from the source folder to the target folder if it if older than one week. I have the script to find the date. i am just having trouble with searchign the folder and loops. heres the date code and suggestions:
<SCRIPT>
window.onload=fnInit;
function fnInit(){
//date created
var oCreated=new Date(document.fileCreatedDate);
//Todays date
var oToday=new Date();
//There are 86400000 milliseconds in a day
var iMilliSeconds=86400000;
var iDaysBetween=(oToday.getTime() - oCreated.getTime()) / iMilliSeconds;
alert("Created: " + oCreated + "\nDays since created: " +
parseInt(iDaysBetween));}
If idaysbetween > 6 CopyTo ("e:\group_1\app1")

</SCRIPT>
Reply With Quote
  #2 (permalink)  
Old 03-31-03, 19:36
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
FSO to the rescue...

You need to use the VB FileSystemObject.

I suggest you download a copy of the VBScript Language Reference from the microsoft site, and take a look at the FSO chapter.

It has TONS of examples showing how to do what you want to do.

Tim
__________________
Tim
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On