General discussion

  • Creator
    Topic
  • #2081320

    VB: determining the size of a directory

    Locked

    by dwtk9 ·

    Hi ,
    2 Questions

    My name is Derek . I’ve just wrote a program to copy files from a local directory to a network drive.

    Question 1: I need to know how I can use VB5 to determine the size of the local directory before sending copying the files over to the network drive.
    The purpose of doing so is to ensure that users do not copy to big files to the network drive via this program I wrote. I tend to keep the space limit about 600 MB per local dir.

    Question 2: How do I schedule the vb program to run every Friday at 2pm.

    Please let me know soon

All Comments

  • Author
    Replies
    • #3899041

      VB: determining the size of a directory

      by yuri ·

      In reply to VB: determining the size of a directory

      1. You can use the FileSystemObject and Folder objects. A Folder object has a Files property which is a collection of File objects. Iterate over it using For Each, summing the file sizes and calling the folder size function recursively for subfolders.

      2. Use any available task scheduler. Microsoft Plus! for Windows 95 includes one called System Agent. Internet Explorer 4.0 and higher contains the Task Scheduler, a successor to System Agent.

    • #3891998

      VB: determining the size of a directory

      by krokodil ·

      In reply to VB: determining the size of a directory

      Q2 (sheduling): Insert Timer object in your program, set Interval to 750. In the Timer Sub write code that will check the day in weak ad time like this:
      sheduleday=6
      ‘Sunday=1;Monday=2;Tuesday=3 …
      shedulehour= “14:00:00”
      daycheck= WeekDay(Date)
      hourcheck= Time
      If daycheck=sheduleday and hourcheck=shedulehour then …

      You must insert some code to disable that this routine runs 2 times at each shedule

Viewing 1 reply thread