SSH.NET icon indicating copy to clipboard operation
SSH.NET copied to clipboard

How to symlink a file in the same directory

Open axelgenus opened this issue 2 years ago • 0 comments

I am using SSH.NET version 2024.0.0 (just upgraded).

I need to create a symlink to a file which is on the same folder with SftpClient.

The remote folder structure is pretty simple:

/
/exports
/exports/20240201.log
[...]
/exports/20240221.log
/exports/20240222.log
/exports/latest.log

latest.log needs point to the latest log (20240222.log in this case).

I tried using sftpClient.SymbolicLink("20240222.log", "latest.log") but GetCanonicalPath changes the path, resulting in a link to /20240222.log (which is wrong because it points to the root directory). I tried changing the working directory to "exports" but that results in a link to /exports/20240222.log (which is also wrong because the file is in the same folder).

Is this feasible?

axelgenus avatar Feb 22 '24 14:02 axelgenus