func (driver *ClientDriver) RenameFile(cc server.ClientContext, from, to string) error {
	from = driver.baseDir + from
	to = driver.baseDir + to
	return os.Rename(from, to)
}
RenameFile renames a file or a directory
package ftpServerDriver
import (
	"crypto/tls"
	"errors"
	"io/ioutil"
	"os"
	"github.com/fclairamb/ftpserver/server"
	"github.com/go-kit/kit/log"
)
var TempDir = os.TempDir() + "\\ftpServerTest"
func NewTestServer(debug bool) *server.FtpServer {
	return NewTestServerWithDriver(&ServerDriver{Debug: debug})
}
func NewTestServerWithDriver(driver *ServerDriver) *server.FtpServer {
	if driver.Settings == nil {
		driver.Settings = &server.Settings{}
	}
	if driver.Settings.ListenAddr == "" {
		driver.Settings.ListenAddr = "127.0.0.1:0"
	}
	s := server.NewFtpServer(driver)
	if driver.Debug {
		s.Logger = log.With(
			log.NewLogfmtLogger(log.NewSyncWriter(os.Stdout)),
			"ts", log.DefaultTimestampUTC,
			"caller", log.DefaultCaller,
		)
	}
	if err := s.Listen(); err != nil {
		return nil
	}
	go s.Serve()
	return s
}
type ServerDriver struct {
	Debug bool  
	TLS   bool
	Settings *server.Settings  
	server.FileStream
}
type ClientDriver struct {
	baseDir string
	server.FileStream
}
func NewClientDriver() *ClientDriver {
	return &ClientDriver{baseDir: TempDir}
}
func (driver *ServerDriver) WelcomeUser(cc server.ClientContext) (string, error) {
	cc.SetDebug(driver.Debug)
	return "TEST Server", nil
}
func (driver *ServerDriver) AuthUser(cc server.ClientContext, user, pass string) (server.ClientHandlingDriver, error) {
	if user == "test" && pass == "test" {
		if err := os.MkdirAll(TempDir, 0777); err != nil {
			return nil, err
		}
		clientDriver := NewClientDriver()
		if driver.FileStream != nil {
			clientDriver.FileStream = driver.FileStream
		}
		return clientDriver, nil
	}
	return nil, errors.New("bad username or password")
}
func (driver *ServerDriver) UserLeft(cc server.ClientContext) {
}
func (driver *ServerDriver) GetSettings() (*server.Settings, error) {
	return driver.Settings, nil
}
func (driver *ServerDriver) GetTLSConfig() (*tls.Config, error) {
	if driver.TLS {
		keypair, err := tls.X509KeyPair(localhostCert, localhostKey)
		if err != nil {
			return nil, err
		}
		return &tls.Config{Certificates: []tls.Certificate{keypair}}, nil
	}
	return nil, nil
}
func (driver *ClientDriver) ChangeDirectory(cc server.ClientContext, directory string) error {
	_, err := os.Stat(driver.baseDir + directory)
	return err
}
func (driver *ClientDriver) MakeDirectory(cc server.ClientContext, directory string) error {
	return os.Mkdir(driver.baseDir+directory, 0777)
}
func (driver *ClientDriver) ListFiles(cc server.ClientContext) ([]os.FileInfo, error) {
	path := driver.baseDir + cc.Path()
	files, err := ioutil.ReadDir(path)
	return files, err
}
func (driver *ClientDriver) OpenFile(cc server.ClientContext, path string, flag int) (server.FileStream, error) {
	path = driver.baseDir + path
	if (flag & os.O_WRONLY) != 0 {
		flag |= os.O_CREATE
		if (flag & os.O_APPEND) == 0 {
			if err := os.Remove(path); err != nil {
				return nil, err
			}
		}
	}
	if driver.FileStream != nil {
		return driver.FileStream, nil
	}
	return os.OpenFile(path, flag, 0666)
}
func (driver *ClientDriver) GetFileInfo(cc server.ClientContext, path string) (os.FileInfo, error) {
	path = driver.baseDir + path
	return os.Stat(path)
}
func (driver *ClientDriver) CanAllocate(cc server.ClientContext, size int) (bool, error) {
	return true, nil
}
func (driver *ClientDriver) ChmodFile(cc server.ClientContext, path string, mode os.FileMode) error {
	path = driver.baseDir + path
	return os.Chmod(path, mode)
}
func (driver *ClientDriver) DeleteFile(cc server.ClientContext, path string) error {
	path = driver.baseDir + path
	return os.Remove(path)
}