-
-
Notifications
You must be signed in to change notification settings - Fork 932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream.SetLength() not truncating file #1454
Comments
You are not doing what you think you are doing. |
Isn't the whole point of a stream that it's directly connected to the file? If I read the stream, it's from the file and if I write to the stream, it is reflected in the file. Changing the length should also reflect the file. But there is no Or am I missing something and is there a way to truncate a file? |
In fact, SSH.NET/src/Renci.SshNet/Sftp/SftpFileStream.cs Lines 1003 to 1005 in 252c732
But perhaps something is going wrong here |
I'm trying to truncate a file on a SFTP server by opening a stream and then setting the length. The docs state that the stream will be truncated to the provided length. But the file remains unchanged.
The stream is working when I append more data to the file or if I make changes, but it won't get smaller. Thus I can't remove text from the file.
How can I remove all bytes from a file past a certain length?
The text was updated successfully, but these errors were encountered: