Community discussion

Files and Folders

This is a comment thread discussing Files and Folders
  • 6 years ago

    This tutorial about Files and Directories are Especially useful.But for the sake of Security ,hiding a file or a Folder is a Must.How Could we do it From VB application.Any useful API's dedicated for it....
     Anybody help Please..

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 6 years ago

    Hello


    I would like to know, how to read a file in binary mode, the other
    way around ( from the end to the beginning of the file).


    Thanks in advance
    Ignacio Cemeli
    ignasicemeli@hotmail.com



  • 6 years ago

    After all the search I think I found something very complete, "friendly" speech, and lots of examples.


    This is what I look in a book/tutorial or whatever.


    Congrats to the author


    LMDG

  • 5 years ago

    If the program has multiple files open at the same time, how do I find the files nFileNum identifier so I can close a particular one?


    Is there a piece of code that can return this?


    I have the names and addresses of the files stored in an array, might be of a use.


    Thanks buddeh, the rest of it really helped

  • 5 years ago

    First you need the filesize, I forget how to find it so we'll assume it's 20 bytes. ^_^; Then you'll need enough memory to hold it all. In this case to make things simple, we'll output the data to another file.


    offset = 20
    offset2 = 1
    do while offset >0
    get #1, offset, variable
    put #2, offset2, variable
    offset = offset - 1
    offset2 = offset2 + 1
    loop


    Something along those lines should work, I'm a little rusty. I just stared a week or two ago.

  • 5 years ago

    I think nFileNum is just a variable for the file number, for another file you'd have to use something else. I'm probably wrong though.

  • 5 years ago

    You're right, but it's not what I meant.


    I wanted a way of finding what the Filenumber of a particular file was.


    Doesn't matter now though, I found a way around it and have finished the program entirely.


    lol, thanks anyway

  • 5 years ago

    dear all,
    i am soorya need some API samples in VB to Hide Files and folders for security purpose.
    most of the samples i get from pscode.com is useless...


    can any one pls. let me some to


    soorya@vsnl.com


    thanks in advance
    soorya

  • 5 years ago

    It's too Late.i know .
    If you really want to hide some files and FOLDERS from your computer, other than do it yourself....you could download a Wonderful program from PCMagic's MAGIC FOLDER....

  • 4 years ago

    I'd like to know how to get a list of files that are in a folder and put the file names into an array.

  • 4 years ago

    Function GetFileList(FileSpec As String) As Variant
    '   Returns an array of filenames that match FileSpec
    '   If no matching files are found, it returns False


       Dim FileArray() As Variant
       Dim FileCount As Integer
       Dim FileName As String
       
       On Error GoTo NoFilesFound


       FileCount = 0
       FileName = Dir(FileSpec)
       If FileName = "" Then GoTo NoFilesFound
       
    '   Loop until no more matching files are found
       Do While FileName <> ""
           FileCount = FileCount + 1
           ReDim Preserve FileArray(1 To FileCount)
           FileArray(FileCount) = FileName
           FileName = Dir()
       Loop
       GetFileList = FileArray
       Exit Function


    '   Error handler
    NoFilesFound:
       GetFileList = False
    End Function

  • 4 years ago

    i want to have a tutorial of hiding folders or files if there is one...........................

  • 4 years ago

    can anyone recommend a book or tutorial about hiding a file and folder..............

  • 4 years ago

    Hello there...


    I have problems manipulating very big text files (I´m talking about files around 10 MB of plain text!!) and I have  to find certain kind of words in the document (parse).


    The files have a columns format (like vectors):


    Var1      Var2      Var3     ....   Var10
    Value1   Value1   Value1  ....   Value1
    Value2   Value2   Value2  ....   Value2
    Value3   Value3   Value3  ....   Value3
    ...          ...          ...                ...
    ValueN   ValueN   ValueN  ....   ValueN


    ///--------Comment line-----///


    Var11      Var12      Var13     ....   Var20
    and so on...


    I can calculate the size of the vectors because they have the same size, but I don't know how many "keywords" are because they vary file to file...


    Currently I'm reading the files Line by Line... and it's like hell!!
    I found in a book that I can open the file using the Random Method and the Get and Seek functions but I don't know exactly how to use them.


    Thanks in advance!!

  • 3 years ago

    I'd like to allow a user to select a directory path, then parse a bunch of files in that directory. I have the parsing part down, and I can hard code a directory in just fine, however I need to enable people to select a directory in order to make this mini-app useful.


    ...My issue is two fold,


    1. I need direction as to how to create a form in VB that will give users the ability to select a directoy. (I am new to vb, and not sure where to start. I am not asking anyone to do it for me, but if you could point me to a tutorial, example online that would help it'd be great.


    2.  I am using the ".LookIn = """ command to specify a directory right now. I am having problems specifying a variable (E.g. Dir = "C:/folder/subfolder", then .LookIn = Dir) doesn't seem to work) Any ideas as to why?

  • 3 years ago

    Ok, for those of us who are begining like me, I was able to find my mistake for number 2.  I simply had the syntax mixed up for the Dir function..I thought I could use it as a variable name...I was wrong.


    Dim fp ' declare my variable that I want to use for the directory


    fp = Dir("C:\work\venturaModify\06144") ' Set the variable equal to "a directory. This is where I am trying to make the user select this path, instead of me hardcoding it in.


    ...further into the "FileSearch" function I set the directory like this:


    .LookIn = Dir(fp)


    ...I am still struggling with my forms..I went through the tutorial by James, but haven't found anything online about selecting a Path via a form I can create.


    .-j

  • 3 years ago

    I've been able to follow your examples regarding making directories and renaming.


    I would like to know two more things.


    One: How do I check for a directory?
    Reason: I am developing a database that will need to check for a directory's existance using the current month's name as its lable. If the a directory does not exist with the current month's name - I will have code automatically create a new directory using the current month's name each time a new calendar month begins and identified by the system.


    Two: Can I use wild cards? Basically can I do the following in VBA -


    FileCopy "C:\Foldername*.", "D:\DifferentFoldername*."


    Thanks


    Greg

  • 3 years ago

    can anybody plz help me i want to have a sourcec code of hidng folders in windows directory.thanks

  • 3 years ago

    do you a source code of hing folders???

  • 3 years ago

    I am using deppfreeze in my internet cafe.This program protects hard drive from every changes and does not allow save games.When computer restarted all saves dissapear from hard drive.I know the games save directories and i need visual basic code that copies all files in directory to server.Code must overwrite and must include subdirectories.As msdos command does :


    xcopy C:\Program Files\Call of Duty\Main\save*.*  \server\saves\call of duty /e/y


    (/e/y parameter is for overwrite and include subdirectory)


    Can anyone help me.Thnx.

  • 3 years ago

    Hello,


    the article of James is not state of the art.
    To import win32 functions is not the way how you should work with the .NET framework. With a little bit pation you can write a own managed code assemby for INI Files.


    Tom

  • 2 years ago

    Hi all,
    I am a new beginner of Visual basic 6. Even though i read James's article, i don't know how to create a project and add his code as a new module.
    Could you please show me how to create 1 project has 1 command button and 1 optionbox only? Also how to add James' s code to that project?Thanks for your time and understanding.
    PS: tieungao35@yahoo.com

Post a reply

Enter your message below

Sign in or Join us (it's free).