Skip to content

go-pkgz/fileutils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fileutils Build Status Go Report Card Coverage Status

Package fileutils provides useful, high-level file operations.

Details

  • IsFile & IsDir checks if file/directory exists
  • CopyFile copies a file from source to destination, preserving mode
  • CopyDir copies all files recursively from the source to destination directory
  • MoveFile moves a file, using atomic rename when possible with copy+delete fallback
  • ListFiles returns sorted slice of file paths in directory
  • TempFileName returns a new temporary file name using secure random generation
  • SanitizePath cleans file path
  • TouchFile creates an empty file or updates timestamps of existing one

Install and update

go get -u github.com/go-pkgz/fileutils