I've a problematic situation where I should compress an file and so rename it to what the user choose + ".zip"/".rar"/".tar.gz"/".tar".
About compress itself is everything Ok, but when I try to rename the file with something like File.Move()
or FileInfo.Move()
, the name of the compressed file also changes, just like the file extension. Example:
string pathFile = "C:\\Users\\Admin\\Desktop\\myFile.exe";
string finalPath = "C:\\Users\\Admin\\Desktop\\userFile.zip";
string compressedPath = "C:\\Users\\Admin\\Desktop\\myFile.exe.zip";
...
File.Move(compressedPath, finalPath);
The problem here is who userFile.zip , when decompressed, generates a userFile file, without extension. Previously I read that compressed files by GZIP don't have information bisides the byte[] array who was written, and this is the possible cause.
But I want to know if someone knows a way to rename GZIP files or another way to compress files and rename with .NET framework.
Thank you.