Announcement

Collapse
No announcement yet.

Reading date from filenames

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reading date from filenames

    I would like to creat a directory of files, and give each file a name that incoperates with the date. I need PowerBasic to read the system date, and compair it to the date on the file name. Does anyone know how I might accomplish this?

    For example, in a directory called "\events," I might have the following files:
    01142003-1.raw
    01142003-2.raw
    01152003.raw
    01162003.raw

    Then, depending on what the system date is, PowerBasic would read the system date, and copy the file(s) that matched the date to a different directory.

    Thank you in advance for your help,
    Brent

    ------------------

  • #2
    The routines provided by DirUnit.bas and DateUnit.bas in your
    Example folder will get you most of the way there. The system
    date may be retrieved through the TIME$ and DATE$ functions. If
    you need to handle long filenames, you'll find a library such
    as Hans Lunsing's PBLFN useful. You can download that here:

    http://www.powerbasic.com/files/pub/pbdos/library/

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment

    Working...
    X