Results 1 to 11 of 11

Thread: File Check/Atributes

  1. #1

    Thread Starter
    Hyperactive Member MeTTa@'s Avatar
    Join Date
    Aug 2005
    Posts
    312

    File Check/Atributes

    Say i have a directory of files, i want to make a list (in text) of
    A: file name
    B: Date Modified
    C: file size
    for all the files.

    I want to check the whole directory, anyone know anything i could start off with? Thanks,
    ___
    Dan

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: File Check/Atributes

    This would do. (Replace the debug.prints with your variables)
    VB Code:
    1. Private Sub Command1_Click()
    2.     mydir = "c:\temp"
    3.     file = Dir(mydir & "\*.*")
    4.     Do While file <> ""
    5.         file = mydir & "\" & file
    6.         Debug.Print file
    7.         Debug.Print FileDateTime(file)
    8.         Debug.Print FileLen(file) & " bytes"
    9.         file = Dir
    10.     Loop
    11. End Sub

    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3

    Thread Starter
    Hyperactive Member MeTTa@'s Avatar
    Join Date
    Aug 2005
    Posts
    312

    Re: File Check/Atributes

    cool thanks, makes sense. il give it a throw.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: File Check/Atributes

    I would suggest loading them into a listview. It will make things much cleaner and easier to read.

  5. #5
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: File Check/Atributes

    Quote Originally Posted by Hack
    I would suggest loading them into a listview. It will make things much cleaner and easier to read.
    Me too


    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  6. #6

    Thread Starter
    Hyperactive Member MeTTa@'s Avatar
    Join Date
    Aug 2005
    Posts
    312

    Re: File Check/Atributes

    lol, great minds think alike, im doing that right now. :/ Im a little slow tho, if ya want help me out, if not kool, i get it at my pace.

  7. #7

    Thread Starter
    Hyperactive Member MeTTa@'s Avatar
    Join Date
    Aug 2005
    Posts
    312

    Re: File Check/Atributes

    nevermind, easy. (sorry for the spammin, il edit now)

    EDIT: Ok, it lists files, what about sub directories/files, i think it would get complex, but is there any tricks?
    Last edited by MeTTa@; Nov 6th, 2006 at 02:35 PM.

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: File Check/Atributes

    Quote Originally Posted by MeTTa@
    nevermind, easy. (sorry for the spammin, il edit now)

    EDIT: Ok, it lists files, what about sub directories/files, i think it would get complex, but is there any tricks?
    There are no tricks...it does get complex. Basically you are talking about a recursive tree walk.

    Are you building your own Windows Explorer?

  9. #9

    Thread Starter
    Hyperactive Member MeTTa@'s Avatar
    Join Date
    Aug 2005
    Posts
    312

    Re: File Check/Atributes

    lol no, im making a program that compares 2 directories, 1 local, and 1 on a server. If any local changes are made, the files that are changed get uploaded.

  10. #10
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: File Check/Atributes

    the trick is to use pre-written code.

    there are many excellent API file recursions at VBnet

  11. #11

    Thread Starter
    Hyperactive Member MeTTa@'s Avatar
    Join Date
    Aug 2005
    Posts
    312

    Re: File Check/Atributes

    Ok, good suggestion.
    Last edited by MeTTa@; Nov 6th, 2006 at 05:21 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width