Added functionality to clone file permissions when archiving them
This commit is contained in:
parent
fa4e51a0e8
commit
797d6cf1d3
@ -73,6 +73,8 @@ func (r *Repository) ArchiveFile(inFile string) {
|
|||||||
log.Fatalf("Error opening file in ingest: %s.", err)
|
log.Fatalf("Error opening file in ingest: %s.", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
sourceStat, _ := source.Stat()
|
||||||
|
sourceMode := sourceStat.Mode()
|
||||||
defer source.Close()
|
defer source.Close()
|
||||||
|
|
||||||
// attempt to create destination file
|
// attempt to create destination file
|
||||||
@ -82,7 +84,7 @@ func (r *Repository) ArchiveFile(inFile string) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer destination.Close()
|
defer destination.Close()
|
||||||
destination.Chmod(0755)
|
destination.Chmod(sourceMode)
|
||||||
|
|
||||||
// perform the file copy
|
// perform the file copy
|
||||||
_, err = io.Copy(destination, source)
|
_, err = io.Copy(destination, source)
|
||||||
|
Loading…
Reference in New Issue
Block a user