Hi, I'm not good with commandline and directories. Can anyone provide me with the instructions to list all the subfolders in an archive folder like 7z, zip, and rar?
If anyone can help me out with the line of commands for all files in all subfolders as well, I would greatly appreciate it. If I need to do something so 7-zip commands can work on cmd, please provide instructions for that as well.
Last edit: Baror Liger 2019-07-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For simple "7z.exe l archive.7z > file.txt" you have to be in the same directory where is 7z.exe and archive.7z, but you probably will be in "C:\WINDOWS>", but you may navigate or point to those.
So navigate to directory where you installed 7-Zip (probably "C:\Program Files\7-Zip\") and point to place where is your archive, for example:
go to root C: drive directory (C:) and then by pressing first letter(s) of directory you want to go (pr) and press "tab" key for auto competition. If there is space in directory name/filename use " before name ("C:\Program File and press "tab").
I'm not in windows now and don't remember it's directory structure, but you may try something like this:
C:>"C:\Program Files\7-Zip\7z.exe" l "C:\Users\Your user name\Desktop\archive.7z" > file.txt
or
C:\Program Files\7-Zip>7z.exe l "C:\Users\Your user name\Desktop\archive.7z" > archive.txt
useful commands in cmd:
cd -display in what directory you are
cd .. -up 1 directory
cd \ -root dir on drive, for example on C: "C:\ "
cd "dir name" -go to directory "dir name" (" because of space in name)
dir -display contents of current directory
dir /? -display help about dir command
D: -change to drive "D:\"
Try yourself and write how it went.
Last edit: mdadm 2019-07-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C:\Program Files\7-Zip\7z.exe l "C:\Users\PCWin7\Desktop\1.7z" > archive.txt
And it said this:
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
I think that command should support it. It's in the help file after all. I just can't get the command to work properly. I tried running cmd as admin as well, but didn't work.
Edit:
So I tried this after:
cd C:\Program Files\
7-Zip\7z.exe l "C:\Users\Anonymous\Desktop\1.7z" > archive.txt
Then it said:
Access is denied.
I don't have a password or anything for the archive.
So then I tried running cmd as admin for the steps and it didn't say anything, so I assumed it worked. I tried to look for the archive.txt, but couldn't find it anywhere.
Last edit: Baror Liger 2019-07-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yeah, note that your path to 7z.exe contains a space character. Thus, you will have to surround it with double quotes ("c:\Program Files\7-zip\7z.exe"), otherwise cmd.exe will treat this as two separate arguments (delimited by the space character) c:\Program and Files\7-zip\7z.exe That problem/behavior is not about 7z.exe at all, just the bog-standard mode of operation of Windows' cmd.exe command line processor ;-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I'm not good with commandline and directories. Can anyone provide me with the instructions to list all the subfolders in an archive folder like 7z, zip, and rar?
If anyone can help me out with the line of commands for all files in all subfolders as well, I would greatly appreciate it. If I need to do something so 7-zip commands can work on cmd, please provide instructions for that as well.
Last edit: Baror Liger 2019-07-13
7z.exe l archive.7z > file.txt
What if the archive was located on my desktop? I don't think i can use 7z.exe just like that. Do I have to point to it as well?
Last edit: Baror Liger 2019-07-16
press Ctrl+r and write cmd.exe
For simple "7z.exe l archive.7z > file.txt" you have to be in the same directory where is 7z.exe and archive.7z, but you probably will be in "C:\WINDOWS>", but you may navigate or point to those.
So navigate to directory where you installed 7-Zip (probably "C:\Program Files\7-Zip\") and point to place where is your archive, for example:
go to root C: drive directory (C:) and then by pressing first letter(s) of directory you want to go (pr) and press "tab" key for auto competition. If there is space in directory name/filename use " before name ("C:\Program File and press "tab").
I'm not in windows now and don't remember it's directory structure, but you may try something like this:
C:>"C:\Program Files\7-Zip\7z.exe" l "C:\Users\Your user name\Desktop\archive.7z" > file.txt
or
C:\Program Files\7-Zip>7z.exe l "C:\Users\Your user name\Desktop\archive.7z" > archive.txt
useful commands in cmd:
cd -display in what directory you are
cd .. -up 1 directory
cd \ -root dir on drive, for example on C: "C:\ "
cd "dir name" -go to directory "dir name" (" because of space in name)
dir -display contents of current directory
dir /? -display help about dir command
D: -change to drive "D:\"
Try yourself and write how it went.
Last edit: mdadm 2019-07-16
I'm using 7-Zip 9.20.
I tried this:
And it said this:
I think that command should support it. It's in the help file after all. I just can't get the command to work properly. I tried running cmd as admin as well, but didn't work.
Edit:
So I tried this after:
I don't have a password or anything for the archive.
So then I tried running cmd as admin for the steps and it didn't say anything, so I assumed it worked. I tried to look for the archive.txt, but couldn't find it anywhere.
Last edit: Baror Liger 2019-07-16
Yeah, note that your path to 7z.exe contains a space character. Thus, you will have to surround it with double quotes (
"c:\Program Files\7-zip\7z.exe"
), otherwise cmd.exe will treat this as two separate arguments (delimited by the space character)c:\Program
andFiles\7-zip\7z.exe
That problem/behavior is not about 7z.exe at all, just the bog-standard mode of operation of Windows' cmd.exe command line processor ;-)In cmd try:
cd
(cd alone will display your current directory and then will be archive.txt file when you run command below):
"C:\Program Files\7-Zip\7z.exe" l "C:\Users\Anonymous\Desktop\1.7z" > archive.txt
If your current directory is "C:\" or "C:\WINDOWS\" then you must have admin rights to write to this directories.
If you don't want to run this commands with admin rights first change to other directory where you have rights to write:
cd "C:\Users\Anonymous\Desktop\"
cd (to show current dir)
"C:\Program Files\7-Zip\7z.exe" l "C:\Users\Anonymous\Desktop\1.7z" > archive.txt
For 7-Zip x64 (64-bit) command with install path will be:
"C:\Program Files (x86)\7-Zip\7z.exe" l "C:\Users\Anonymous\Desktop\1.7z" > archive.txt
Last edit: mdadm 2019-07-17