Results for "Category: Files/ File Controls/ Input/ Output"
This code returns a true/false if a specified drive/directory/pathname exists. This is a small, fast routine.
A short pathname of the passed string containing a long pathname. 'For example it turns "C:\Windows\MY Long Path Name\My Long Name File.txt" into "c:\windows\mylong~1\mylong~1.txt" (The actual resulting pathname is determined by the short names that windows assigns to all files and directories). 'This is useful when you need to create a fail proof pathname (assuming the file exists and is accesible).
This Procedure Deletes all Files in Directory as well as all Sub Directories and Files
This sub/function searches your hard drive(s) or directories for file(s) like the Windows 'Find Files or Folders...'. It uses mainly the Dir() command and can be used with any programs and visual basic I have encountered. This helps uses to quickly find a file or program for their applications.
This code is for those people who want to open up folders/directories as separate windows, as compared to the alternative fileboxes.
To be able to make files on the fly. To embed those files within the executable of the vb program. To have one exe file that can make dependent files as needed.
quite nasty hexeditor in vb6 can handle files upto 2.1 gb (uses a custom filebuffer to avoid loading all data at once) supports copy paste , delete / insert bytes and multiple documents.. i saw some other guy has submitted his hexeditor so i figure i could just as well submit mine to instead of letting it just rott on my hd... its not finnished but its still quite nice , hope you like it... start hexed.vbp list of features: filebuffer (load files upto 2.1 gb) copy paste data in both hex/text mode mdi app custom scrollbar to allow more than 32k lines file compare tool , compare 2 or more files string extractor , extract strings (ansii/unicode)
Suffering with the problem of lack of disk space I knew there must be a directory on my hard disk that contained a lot of information, this is why I wrote this application. Its simple in what it does but can provide useful information about your hard disk space. It allows you to select a drive and then by using a tree control lets you navigate through it displaying hard disk usage for each folder it sees..
This is version 2 of my directory sizer. This has been brought on by the comments left for the previous submission. Its idea is simple but is useful where by it lists sizes of directories in a Treeview. In this version I fixed a little bug with duplicate keys and have also made the directories sorted by space used.
This procedure finds a file and returns the full path, provided a partial path it will search all sub dirs. No looping only 1 API - this is the kind. I can't really take credit for putting an api to use, just sharing something that you might find useful.
It sets the Attributes for any file. including hidden read only and archive.
Very easy to delete your directory without going through the hastle of deleting all the files and sub directories first.
This code shows how to load an Explorer type treeview control using the FileSystemObject. The heart of the code is modTreeview, where all the work takes place. You can drop this module into your project, reference the FileSystemObject and go. All the code is here to show you how to load the treeview control, handle clicks and get the path back. Nothing majorly spectacular but handy. It is also fast loading because it doesn't load the next "level" until the user clicks...just like windows explorer.
Want to put an .ini file INSIDE your .exe file? Yep...it's another file attachment sample. I've commented it heavily for newbies. There are only 2 subs, very short and to the point. It should help get you off the ground if you've never done this before.
This code will count all of the lines in a text File. This code will work on any sized file, and is quicker than using LineInput or the FSO.
Lets you create A windows cabinet file (.cab) containing any file(s) of YOUR choice. Since a cabinet file is something windows uses. Once you make it, you can give it to anyone and they can open/extract it without special files. PLEASE vote and/or leave feedback/comments on what you think.
Allows you to backup a source file and have the destination file name be the current date. Great for database backups!
This very simple routine avoid checking if a correct path already exist before using it and, if not, create it exactly as you want. Imagine you wont to write a log file in a path defined as: C:\Myapplic\Services\logs\LOG.TXT you must check before if the directory Myapplic exist and then check all other subdirectory (Service,logs) before opening the file For Output. Probably you will use a lot of Error Resume Next, Mkdir(...), Error GoTo 0, dir(....) and so. Instead you can use this routine as described below: Myfile="C:\Myapplic\Services\logs\LOG.TXT" Call CheckDir(Myfile) nf=FreeFile() Open Myfile For Output As #nf . . . Close #nf and including the following .bas module: Public Sub CheckDir(file) Ix = 4 'Initial index KSlash = InStr(1, file, "\", 1) 'Search for first "\" For Cnt = 1 To Len(file) 'Run until discover 'other directories KSlash = InStr((KSlash + 1), file, "\", 1) If KSlash = 0 Then Exit For 'Last slash dir1 = Left(file, (KSlash - 1)) cdir1 = Mid(dir1, Ix) Ix = Ix + Len(cdir1) + 1 hh = Dir(dir1, vbDirectory) 'If Directory doesn't exist, create it If StrComp(hh, cdir1, 1) 0 Then MkDir (dir1) End If Next Cnt End Sub
For those of you who want to add a touch of professionalism to your program, now you can create a file type in the Windows Registry database which will associate all files ending with your program's file extension ( yourfile.xxx) to your program. You also specify an icon for your file type and a description. This example also shows you how to use Command$ to open these files in your program when once the file is clicked or opened, and a quick tip on creating files in the Windows Recent file folder (Start > Documents).
Read large text files faster. Reads lines in text files about 30% faster then the TextStream class. Skips much faster.