Posts

Showing posts from 2011

How to compress directory with 7-Zip without adding directory path

Window context menu has a handy 7-Zip actions to compress selected directory, but it has one problem: it puts directory into archive. Here is command line how to avoid that: 7z a -r -tzip [directory].zip .\[directory] \* That's not too handy to type it, so it's very simple to add command to the Total Commander bar. Command: 7z.exe Parameters: a -r -tzip %N.zip .\%N\*

How to export data into UTF-8 without BOM in Visual Basic

Create stream for UTF-8. Set sqlStream = CreateObject("ADODB.Stream") 'Init stream sqlStream.Open sqlStream.Position = 0 sqlStream.Charset = "UTF-8" Write your data into the stream. Dim binaryStream As Object Set binaryStream = CreateObject("ADODB.Stream") binaryStream.Type = 1 binaryStream.Mode = 3 binaryStream.Open 'Skip BOM bytes sqlStream.Position = 3 sqlStream.CopyTo binaryStream sqlStream.Flush sqlStream.Close binaryStream.SaveToFile sqlFilename, 2 binaryStream.Close