cmdline option not working

Help
Evald
2013-09-26
2013-09-26
  • Evald

    Evald - 2013-09-26

    Hello,
    i'm trying to use the -ssw option(http://sevenzip.sourceforge.jp/chm/cmdline/switches/shared.htm) but without success. I have locked a file and 7zip is not able to add it to an archive complaining it is used by another process?
    Any idea why this option is not working?

    Tested on win8 64bit and win7 64 bit

    Thanks,
    Regards

     
    Last edit: Evald 2013-09-26
  • Igor Pavlov

    Igor Pavlov - 2013-09-26

    There are some lock modes that are not supported by 7-Zip.
    What program locks your files?

     
  • Evald

    Evald - 2013-09-26

    Which are these lock modes not supported?
    I'm using sample C# test application.

    using (FileStream fs = File.Open("c:\testfile.txt", FileMode.Open, FileAccess.Read))
    {
    // use fs
    Thread.Sleep(1000000);
    }

     
  • Igor Pavlov

    Igor Pavlov - 2013-09-26

    Please show exact command that you use to call 7-zip and output of 7-zip.

     
  • Evald

    Evald - 2013-09-26

    7z a archive.7z -ssw c:\testfile.txt

     
  • Igor Pavlov

    Igor Pavlov - 2013-09-26

    OK. Now call
    7z l archive.7z

     
  • Evald

    Evald - 2013-09-26

    i'm using the following simple bat script
    --------------begin script------------------------------------
    7z a archive.7z -ssw c:\testfile.txt
    7z l archive.7z
    pause
    --------------end script--------------------------------------

    it has created an empty archive

     
  • Evald

    Evald - 2013-09-26

    You can use the attached file to lock a text file and then try with 7zip.
    Within the zip file you will find also the source code for the blockfile program.

     
  • Igor Pavlov

    Igor Pavlov - 2013-09-26

    1) Do another programs (like WinRAR) can work with such txt file?
    2) Maybe you must specify also FileShare of File.Open method.

     
  • Evald

    Evald - 2013-09-26

    1) No, winrar does not work. It does not even have an option similar to -ssw
    2) Specifying the FileShare as FileShare.Read or FileShare.ReadWrite, 7zip works. In other cases it does not. Instead winrar fail in all cases

     
    • fernando

      fernando - 2013-09-26

      1) No, winrar does not work. It does not even have an option similar to -ssw

      Switch -DH - open shared files
      Allows to process files opened by other applications for writing.

       
  • Igor Pavlov

    Igor Pavlov - 2013-09-26

    If you don't all to read that file with FileShare.*, 7-Zip can't read that file.
    So do you think that 7-Zip works OK?

     
  • Evald

    Evald - 2013-09-26

    I think 7-zip is working partially. There are some kind of locks which cannot hanlde.
    btw, i have found a tool called hobocopy which makes a copy of a file even if it is locked, so before zipping a file i'll make a temp copy, than zip the file and then delete the temp...

     
    Last edit: Evald 2013-09-26
  • Igor Pavlov

    Igor Pavlov - 2013-09-26

    7-Zip can't handle another cases with locks of regions inside files.
    Your case is another problem. And that problem is solved with
    correct FileShare.* options.

     
  • Evald

    Evald - 2013-09-26

    Thank you.
    Regards

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks