File manipulation can be done very easily through VB code. The easiest way, IMO, is to use a simple I/O (input/output) method rather than to mess around with the File System Object ("fso" variable you usually see in code). I/O is popular when working with binary files, etc. The I/O method is nothing more than a technique that's available in VB where you can open a sort of "portal" and throw data back and forth between two files.
But at any rate...there's plenty of stuff that I/O can do for you, and even simplify. Namely, it can perform plenty of one-liner operations that would otherwise take some thought. Some are:
Get a file size in bytes:
Code:
File Size = FileLen("Path of File")
and of course from there you can use simple multiplication to calculate the format (KB, MB, GB, whatever) of the file size that you want.
Copy a File:
Code:
FileCopy "Source File", "New File"
Rename a File or Directory:
Code:
Name "OldPath" As "NewPath"
Delete Files:
Code:
Kill "FileName"
Kill "[Directory]\*.[Extension]" 'To delete all files of one specific type
Get Last Modification Timestamp for a File:
Code:
FileDateTime "FilePath"
But not only are the above operations available, you can use I/O to simplify data sharing in files like .txt, .ascii, etc...
To read a file, open it for Input:
Code:
Open "FilePath" For Input As #1
Once your file is open...
Get the entire file contents:
Code:
Variable = Input(LOF(1), 1)
(what's amusing about the above method is that LOF() works because INPUT() asks for the number of characters to read and LOF() returns the size of the file in bytes. So this one liner works great because 1 binary byte = 1 ASCII character).
To write to a file, open it for Output:
Code:
Open "FilePath" For Output As #1
Once your file is open...
Write Data To The File:
Append Data To The End of the File (requires different I/O mode):
Code:
Open "FilePath" For Append As #1
Write #1, "String"
So that's a little of the easy stuff. You can do all sorts of other things with I/O that don't take near as much time as other methods in VBA do. Most of them you can find in VBA help. The Get, Put, EOF and LOF can also be useful, but they require a little more study to get use to.