I have a program which runs as Linux based container in Ubuntu system. The project is written using .NetCore libraries.
From my 'root' directory in Ubuntu I can set the path as below and see existing file there
root@user: cd /var/abc/modules/moduleOne/files
Inside that path a file exists named 'logs.txt'
How to copy that file and paste with different name?
I was trying as below
var destination = "//var//abc//modules//moduleOne//files//copy.txt";
var source = Path.Combine("//var//abc//modules//moduleOne//files", "logs.txt");
File.Copy(source, destination);
It throws error in runtime as below
Exception occurred Could not find a part of the path '/var/abc/modules/moduleOne/files/logs.txt'
I have tested the following code inside a docker linux container and it works:
File.WriteAllText("/test.txt", "Test");
string destination = "/var/copy.txt";
string source = Path.Combine("/", "test.txt");
System.IO.File.Copy(source, destination);