Closed Argimko closed 1 year ago
What exactly is the problem here?
CryptSync aready uses the long-path notation. Also just FYI: prepending \\?\
to a path allows for paths to be longer than 254 chars, not filenames. And dir names are even limited to 248 chars.
So: long path name support is already done. long file name support is not possible.
Ok, I see. I double recheck everything. So, I understand about long path/long file names. Yes, I agree with you that names couldn't be longer than 248 chars.
Now I will use more correct naming: long paths.
I am using CryptSync v1.4.4.462 and I think it does not support long paths.
Case 1, without \\?\ prefix
I have folder: D:\Desktop\Long Src
which contain file with long path 283 chars:
D:\Desktop\Long Src\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Test.png
Every folder name has length 84 chars that less than 248. It's ok.
And I have empty dir D:\Desktop\Long Dst
So now I am running:
"%PROGRAMW6432%\CryptSync\CryptSync.exe" /src:"D:\Desktop\Long Src" /dst:"D:\Desktop\Long Dst" /mirror /progress /logpath:"D:\Desktop\log1.txt"
And the file Test.png
is not synced, the D:\Desktop\Long Dst
stays empty and log file is:
Starting CryptSync
syncing folder orig "D:\Desktop\Long Src" with crypt "D:\Desktop\Long Dst"
settings: encrypt names: no, use 7z: no, use GPG: no, use FAT workaround: no, sync deleted: yes, reset archive attr: no
finished syncing folder orig "D:\Desktop\Long Src" with crypt "D:\Desktop\Long Dst"
exiting CryptSync
Case 2, with \\?\ prefix
I am running:
"%PROGRAMW6432%\CryptSync\CryptSync.exe" /src:"\\?\D:\Desktop\Long Src" /dst:"\\?\D:\Desktop\Long Dst" /mirror /progress /logpath:"D:\Desktop\log2.txt"
And it works, file Test.png.cryptsync
appears at D:\Desktop\Long Dst
folder, log file:
Starting CryptSync
syncing folder orig "\\?\D:\Desktop\Long Src" with crypt "\\?\D:\Desktop\Long Dst"
settings: encrypt names: no, use 7z: no, use GPG: no, use FAT workaround: no, sync deleted: yes, reset archive attr: no
encrypt file \\?\D:\Desktop\Long Src\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Test.png to \\?\D:\Desktop\Long Dst\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Test.png.cryptsync
password is blank - NOT secure - force 7z not GPG
successfully adjusted attribute on \\?\D:\Desktop\Long Dst\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long\Test.png.cryptsync
finished syncing folder orig "\\?\D:\Desktop\Long Src" with crypt "\\?\D:\Desktop\Long Dst"
exiting CryptSync
So: as I see long paths is not supported by default, it will works only if user add \\?\
by himself.
Thank you!
Hi Stefan, thank you for your previous help!
I have request: add long filenames support.
For now, it works well when adding
\\?\
prefix to source, destination folders - it packs and encrypt correctly:But one operation goes wrong – it fails with sync file deletion.
As I see at log, it correctly tries to delete file:
counterpart of file la-la-la does not exist in src folder, delete file
But actually it doesn't delete:
I think this may happened because GetFullPathNameW() is not called for
\\?\
paths – it used for path normalization.So, as I see, generally, using
\\?\
prefix works ok.Regarding to MS documentation https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats I think you can try this way:
C:\Windows
\\?\C:\Windows
to GetFullPathNameW() that supports long filenamesThank you!