How to output the list produced by 7-zip to a file when in command line mode? I've tried the -o and -so switches, but that only produces errors. I'm running the commandline version 7za465 on Windows XP.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry ikxcsshcm7, that didn't work. Even when I provided an empty file, nothing was written to it. I also added a space after > but that also produced nothing. Any other ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I use a vanilla "7za l file.7z" to get screen output, no problem. But if you add anything to that (e.g. > output.txt) it ignores you. If you try to use -o or -so switches it gets real nasty and hangs or even throws up an error 7!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks, ikxcsshcm7. Your suggestion still does not not work, of course, because of that pesky "7za L file.7z >output.txt" call that flatly refuses to do anything. I was hoping there was a simple in-line command that could do the job. Perhaps that's a nice challenge for Mr Pavlov to get his teeth into.
As is is, I devised a simple workaround in Delphi and that works fine although it's not very elegant or efficient. But it works.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To output the list produced by 7-Zip to a file in command line mode, you can use the -scc option followed by the name of the character set to use for the output, and then redirect the output to a file using the > operator. Here is an example of how you can do this:
7z l -sccUTF-8 archive.7z > list.txt
This command will create a file called list.txt in the current directory, and it will contain the list of files in the archive.7z file, encoded in UTF-8 character set.
You can also use the -scsUTF-8 option instead of -sccUTF-8, which will specify the character set to use for both the input and output.
If you want to append the list to an existing file, rather than overwriting it, you can use the >> operator instead of >. For example.
7z l -sccUTF-8 archive.7z >> list.txt
This will add the list produced by 7-Zip to the end of the list.txt file, rather than overwriting it.
I hope this helps!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How to output the list produced by 7-zip to a file when in command line mode? I've tried the -o and -so switches, but that only produces errors. I'm running the commandline version 7za465 on Windows XP.
Try…
Sorry ikxcsshcm7, that didn't work. Even when I provided an empty file, nothing was written to it. I also added a space after > but that also produced nothing. Any other ideas?
What is the command line you are using to output the list produced by 7-zip to the screen?
I use a vanilla "7za l file.7z" to get screen output, no problem. But if you add anything to that (e.g. > output.txt) it ignores you. If you try to use -o or -so switches it gets real nasty and hangs or even throws up an error 7!
The only way to get output to a file is to use redirection…
Thanks, ikxcsshcm7. Your suggestion still does not not work, of course, because of that pesky "7za L file.7z >output.txt" call that flatly refuses to do anything. I was hoping there was a simple in-line command that could do the job. Perhaps that's a nice challenge for Mr Pavlov to get his teeth into.
As is is, I devised a simple workaround in Delphi and that works fine although it's not very elegant or efficient. But it works.
i found this and tried it and it worked!
http://www.tech-recipes.com/rx/9356/7-zip-how-to-list-contents-of-a-folder-and-subfolder-of-zip-files-without-extracting-win-xpvista7-and-command-line/
need to run bat as admin...
Hello!
Use 7za.exe instead 7z.exe. (7za.exe l test.7z> output.txt, 7z.exe - doesn't work).
To output the list produced by 7-Zip to a file in command line mode, you can use the -scc option followed by the name of the character set to use for the output, and then redirect the output to a file using the > operator. Here is an example of how you can do this:
7z l -sccUTF-8 archive.7z > list.txt
This command will create a file called list.txt in the current directory, and it will contain the list of files in the archive.7z file, encoded in UTF-8 character set.
You can also use the -scsUTF-8 option instead of -sccUTF-8, which will specify the character set to use for both the input and output.
If you want to append the list to an existing file, rather than overwriting it, you can use the >> operator instead of >. For example.
7z l -sccUTF-8 archive.7z >> list.txt
This will add the list produced by 7-Zip to the end of the list.txt file, rather than overwriting it.
I hope this helps!