Neding help whit files....

hi, i am trying to make a litle program and i want it to analyze whats in site a folder... and whats insite the folder to.. Like a summary so i afterwords can make like this

Chosen folder "Help me"

Number of folders in "Help me": 5
Numbers of files in "Help me": 36
THe size of all files is: 15000KB

Thanks, hope any of u gueys can help me...
Mark "Rambus666"
No one can find me
Here in my soul
Kicking and screaming
Out of control

Calm myself down now
Nobodu knows
No one can find me
here in my soul

Comments

  • : hi, i am trying to make a litle program and i want it to analyze whats in site a folder... and whats insite the folder to.. Like a summary so i afterwords can make like this
    :
    : Chosen folder "Help me"
    :
    : Number of folders in "Help me": 5

    Use the Dir function. Usage: Call Dir the first time with the directory you want to search and the files you want to search for. Example: [italic]File[/italic] = Dir("c:Help me*.*")
    Note: The second parameter specifies which files to look for. You might also want to specify vbSystem, vbArchive, vbHidden, vbReadOnly. To search directories use vbDirectory!

    Then the first file is returned by Dir. To get the rest of the files, make simultaneous calls to Dir without specifying any parameters. Example: [italic]NextFile[/italic] = Dir()

    Note: Dir function returns the filename without the filepath. So for example "helpme.txt" or "my file.db".

    : Numbers of files in "Help me": 36

    I suggest you use a loop, and every time you find a file, increment a file number counter.

    : THe size of all files is: 15000KB
    :

    Every time you find a file, use FileLen([italic]File[/italic]). Note that filelen requires you to either specify the full filename (with path) or that the file is located in the active directory. Add this number to filesize variable.

    Need any more help? Would you? Dare to? Sure!

    Greets...
    Richard

  • : : hi, i am trying to make a litle program and i want it to analyze whats in site a folder... and whats insite the folder to.. Like a summary so i afterwords can make like this
    : :
    : : Chosen folder "Help me"
    : :
    : : Number of folders in "Help me": 5
    :
    : Use the Dir function. Usage: Call Dir the first time with the directory you want to search and the files you want to search for. Example: [italic]File[/italic] = Dir("c:Help me*.*")
    : Note: The second parameter specifies which files to look for. You might also want to specify vbSystem, vbArchive, vbHidden, vbReadOnly. To search directories use vbDirectory!
    :
    : Then the first file is returned by Dir. To get the rest of the files, make simultaneous calls to Dir without specifying any parameters. Example: [italic]NextFile[/italic] = Dir()
    :
    : Note: Dir function returns the filename without the filepath. So for example "helpme.txt" or "my file.db".
    :
    : : Numbers of files in "Help me": 36
    :
    : I suggest you use a loop, and every time you find a file, increment a file number counter.
    :
    : : THe size of all files is: 15000KB
    : :
    :
    : Every time you find a file, use FileLen([italic]File[/italic]). Note that filelen requires you to either specify the full filename (with path) or that the file is located in the active directory. Add this number to filesize variable.
    :
    : Need any more help? Would you? Dare to? Sure!
    :
    : Greets...
    : Richard
    :
    :



    But how do i do it??? I still dont understand... The app. crashes every time i try... Sorry i cant find out to do it cause i quess you are right.. and the loop i agree i just dunno how..... Sorry
    No one can find me
    Here in my soul
    Kicking and screaming
    Out of control

    Calm myself down now
    Nobodu knows
    No one can find me
    here in my soul

  • : : : hi, i am trying to make a litle program and i want it to analyze whats in site a folder... and whats insite the folder to.. Like a summary so i afterwords can make like this
    : : :
    : : : Chosen folder "Help me"
    : : :
    : : : Number of folders in "Help me": 5
    : :
    : : Use the Dir function. Usage: Call Dir the first time with the directory you want to search and the files you want to search for. Example: [italic]File[/italic] = Dir("c:Help me*.*")
    : : Note: The second parameter specifies which files to look for. You might also want to specify vbSystem, vbArchive, vbHidden, vbReadOnly. To search directories use vbDirectory!
    : :
    : : Then the first file is returned by Dir. To get the rest of the files, make simultaneous calls to Dir without specifying any parameters. Example: [italic]NextFile[/italic] = Dir()
    : :
    : : Note: Dir function returns the filename without the filepath. So for example "helpme.txt" or "my file.db".
    : :
    : : : Numbers of files in "Help me": 36
    : :
    : : I suggest you use a loop, and every time you find a file, increment a file number counter.
    : :
    : : : THe size of all files is: 15000KB
    : : :
    : :
    : : Every time you find a file, use FileLen([italic]File[/italic]). Note that filelen requires you to either specify the full filename (with path) or that the file is located in the active directory. Add this number to filesize variable.
    : :
    : : Need any more help? Would you? Dare to? Sure!
    : :
    : : Greets...
    : : Richard
    : :
    : :
    :
    :
    :
    : But how do i do it??? I still dont understand... The app. crashes every time i try... Sorry i cant find out to do it cause i quess you are right.. and the loop i agree i just dunno how..... Sorry


    Does your app crash? That's pretty intense. VB normally doesn't do that unless you are making API calls!

    I'll just make a quick example:
    [code]
    Dim sFile As String
    Dim nCount As Integer
    Dim lSize As Long

    sFile = Dir("c:Help me*.*", vbNormal Or vbHidden Or _
    vbReadOnly Or vbSystem)

    'If sFile = "" then no files are found
    Do While sFile <> ""
    'Add one to the file count
    nCount = nCount + 1
    'Add the size of the file
    lSize = lSize + FileLen("c:Help me" & sFile)
    'Search for the next file
    sFile = Dir
    Loop

    'TODO: Display results here
    [/code]

    If you want to store all the filenames let me know and I'll give you an example of how to use a string array!

    If you want to use this code you will have to replace all occurences of "c:Help me" with a variable holding the path, so that the path can be selected at runtime.

    I hope you understand this piece of code...

    Greets...
    Richard

  • [b][red]This message was edited by Rambus666 at 2004-7-27 13:18:41[/red][/b][hr]
    [b][red]This message was edited by Rambus666 at 2004-7-27 13:17:40[/red][/b][hr]
    Arrgh what does i du wrong

    Dim sFile As String
    Dim nCount As Integer
    Dim lSize As Long


    sFile = Dir(Dir1.Path & "" & "*.*", vbNormal Or vbHidden Or vbReadOnly Or vbSystem)

    'If sFile = "" then no files are found
    Do While sFile <> ""
    'Add one to the file count
    nCount = nCount + 1
    'Add the size of the file
    error here> lSize = lSize + FileLen(Dir1.Path & sFile)
    'Search for the next file
    sFile = Dir
    Loop
    lblFolderSize.Caption = "Folder size: " & lSize


  • : [b][red]This message was edited by Rambus666 at 2004-7-27 13:18:41[/red][/b][hr]
    : [b][red]This message was edited by Rambus666 at 2004-7-27 13:17:40[/red][/b][hr]
    : Arrgh what does i du wrong
    :
    : Dim sFile As String
    : Dim nCount As Integer
    : Dim lSize As Long
    :
    :
    : sFile = Dir(Dir1.Path & "" & "*.*", vbNormal Or vbHidden Or vbReadOnly Or vbSystem)
    :
    : 'If sFile = "" then no files are found
    : Do While sFile <> ""
    : 'Add one to the file count
    : nCount = nCount + 1
    : 'Add the size of the file
    : error here> lSize = lSize + FileLen(Dir1.Path & sFile)
    : 'Search for the next file
    : sFile = Dir
    : Loop
    : lblFolderSize.Caption = "Folder size: " & lSize
    :
    :
    :

    The error is caused because you forgot the ""! Minor slip, yet very important!
    Have fun and good luck!

    Greets...
    Richard

  • : : [b][red]This message was edited by Rambus666 at 2004-7-27 13:18:41[/red][/b][hr]
    : : [b][red]This message was edited by Rambus666 at 2004-7-27 13:17:40[/red][/b][hr]
    : : Arrgh what does i du wrong
    : :
    : : Dim sFile As String
    : : Dim nCount As Integer
    : : Dim lSize As Long
    : :
    : :
    : : sFile = Dir(Dir1.Path & "" & "*.*", vbNormal Or vbHidden Or vbReadOnly Or vbSystem)
    : :
    : : 'If sFile = "" then no files are found
    : : Do While sFile <> ""
    : : 'Add one to the file count
    : : nCount = nCount + 1
    : : 'Add the size of the file
    : : error here> lSize = lSize + FileLen(Dir1.Path & sFile)
    : : 'Search for the next file
    : : sFile = Dir
    : : Loop
    : : lblFolderSize.Caption = "Folder size: " & lSize
    : :
    : :
    : :
    :
    : The error is caused because you forgot the ""! Minor slip, yet very important!
    : Have fun and good luck!
    :
    : Greets...
    : Richard
    :
    :


    It's working YEHAAA!!! Thanks man, you really helped me out of something wich has been irratating me A LOT for some time....
    Bestt...
    mark "RAmbus666"


    P.s. if you still want to i would be happy to hear about the code wich remembers the filenames... Thanks for all...
    No one can find me
    Here in my soul
    Kicking and screaming
    Out of control

    Calm myself down now
    Nobodu knows
    No one can find me
    here in my soul

Sign In or Register to comment.

Howdy, Stranger!

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

Categories