Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help for a new QBasic programmer

jamesbond123jamesbond123 Member Posts: 1
Is it possible to write a program to check folders and/or files on a drive that I specify and cycle through all my directories and if it finds a file and or folder over 10MB write the file names and folders it finds to a file? Any comments or help would be appreciated greatly. Thanks.

Comments

  • detjdetj Member Posts: 16
    : Is it possible to write a program to check folders and/or files on a drive that I specify and cycle through all my directories and if it finds a file and or folder over 10MB write the file names and folders it finds to a file? Any comments or help would be appreciated greatly. Thanks.
    :

    Well, it is possible. But I don't have much time for doing that.
  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : : Is it possible to write a program to check folders and/or files on a drive that I specify and cycle through all my directories and if it finds a file and or folder over 10MB write the file names and folders it finds to a file? Any comments or help would be appreciated greatly. Thanks.
    : :
    :
    : Well, it is possible. But I don't have much time for doing that.
    :

    Comment:
    Yes, but it's a lot of trouble since QB is lousy on getting file lists and sizes of those files. Lousy means "can't do it", though you could use a few interupt tricks...

    Suggestion:
    Switch to VB if you can. Dir$() makes mincemeat of file lists and some versions (maybe all?) can easily get the file's size.
  • brisraybrisray Member Posts: 60
    Probably the easiest way to do this is to use SHELL and the DIR command.

    SHELL "DIR c:*.* /s > c:
    aydir.txt"

    This form of DIR writes a directory/file listing of the C: drive to a file named raydir.txt The /s tells DIR to include all the subdirectories.

    The listing is done in the old DOS 8.3 file naming convention as QBasic can't handle long file names.

    Here's part of the file from my drive :-

    Directory of C:PROGRA~1COMMON~1MICROS~1VS98RESOUR~1

    .
      09/05/01 8:31p
      ..
        09/05/01 8:31p
        1033
          09/05/01 8:31p
          3 file(s) 0 bytes

          Directory of C:PROGRA~1COMMON~1MICROS~1VS98RESOUR~11033

          .
            09/05/01 8:31p
            ..
              09/05/01 8:31p
              VSHELPUI DLL 18432 06/06/98 12:00a
              3 file(s) 18432 bytes

              You may not know what . or .. mean, . is the DOS notation for the current directory and .. means a shortcut to a higher directory.

              Once the program has written this file, you can open it and extract the information you need from it.

              I've written a file / directory dialog box using this method, you can see the code I used at http://members.lycos.co.uk/brisray/qbasic/qfdlog.htm

              The server that carries my site has been down for a couple of hours so you may not be able to see it for a while.

              Ray
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _______ { http://forcoder.org } free video tutorials and ebooks about [ C Visual Basic Java Swift PHP R MATLAB Visual Basic .NET Assembly Python Ruby Perl Go Delphi C# Objective-C Scratch PL/SQL C++ JavaScript F# FoxPro Julia Scheme Lua Dart Lisp Logo Fortran Rust Ada Bash Transact-SQL Crystal LabVIEW Apex VBScript Kotlin SAS ABAP Erlang Hack Clojure Awk D Scala ML COBOL Alice Prolog ] ________

Sign In or Register to comment.