dexta / sync2Folder

synchronize two folder with images from source to destination

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sync2Folder

synchronize two folder with images from source to destination Configuration with a file config.json searched at Working, Executeable or given Path.

folderSync -conf=/path/to/the/file/

or local development with config in same folder

go run folderSync.go

config.json

{
	"sourceDir": "/home/user/sync2Folder/testSourceDir",
	"destinationDir": "/home/user/sync2Folder/testDestinationDir",
	"fileTypes": ["jpg","png"],
	"logEnable": true,
	"logPath": "/home/user/sync2Folder/testLogFile.log",
	"verbose": true,
	"delete": true,
	"dryRun": false
}

fileTypes

a list image types not file extension we test the minetype here.

var magicTable = map[string]string{
    "image/jpeg":    "jpg",
    "image/png":     "png",
    "image/bmp":     "bmp",
    "image/webp":    "webp",
    "image/svg+xml": "svg",
    "image/gif":     "gif"}

logEnable

Write log to a file

verbose

Print everything

delete

Delete a file in the destinationDir if is not in sourceDir

dryRun

Do not touch any files

About

synchronize two folder with images from source to destination

License:GNU General Public License v3.0


Languages

Language:Go 100.0%