Knightmare Posted August 21, 2018 Share Posted August 21, 2018 I'm trying to use Ketarin to create a portable rescue drive. I'm trying to figure out a way to extract Complete Internet Repair with it's full structure, minus the main folder in the zip file which is named "ComIntRep_{version}." The main files and folders are in the ComIntRep folder, but with each update, that folder name is going to change. I was hoping that there is a way to extract everything within the ComIntRep folder while still maintaining the original structure. Here is the code I use to extract everything, including the ComIntRep folder: 7z x "{file}" -o"{root}SyMenu\ProgramFiles\Complete Internet Repair\" -y del /q "{root}SyMenu\ProgramFiles\Complete Internet Repair\*.zip" Here is what the structure of the original zip looks like: All I want to do is extract the Docs folder, Language folder, Themes folder, the exe files, and the ini file into my output directory. With the code that I have, the output directory looks like this: "{root}SyMenu\ProgramFiles\Complete Internet Repair\ComIntRep_3950" I'm at a loss on what I need to do. Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
andy2004 Posted August 21, 2018 Share Posted August 21, 2018 rebuild the archive from within the folder. the zip file should be in the same folder as Comintrep_3950..after the creation. the name makes no difference. when this zip file is extracted to \complete internet repair\ the files will go straight into it and should be how you wanted it. Link to comment Share on other sites More sharing options...
Knightmare Posted August 23, 2018 Author Share Posted August 23, 2018 On 8/21/2018 at 6:38 PM, andy2004 said: rebuild the archive from within the folder. the zip file should be in the same folder as Comintrep_3950..after the creation. the name makes no difference. when this zip file is extracted to \complete internet repair\ the files will go straight into it and should be how you wanted it. So what would my commands look like? Link to comment Share on other sites More sharing options...
andy2004 Posted August 23, 2018 Share Posted August 23, 2018 exactly the same as you've already put.. its the only way i know of getting rid of the folder. rar can extract without the folder. but your using zip.. the folder in your archive is the issue.. remove the folder, by archiving inside the folder. should fix the issue. why aren't you using 7z as the extension.. as your using 7z to un-zip.. with 7-zip installed and with the intergrate 7-zip to shell context menu.. really simple.. windows explorer folder you want to 7zip.. in the right pane.. select all files, right click, add to archive or add to nameoffile.7z usually the name of the first file selected + 7z. rename to whatever.. created inside the folder.. so no folder name to deal with.. Link to comment Share on other sites More sharing options...
straycat19 Posted August 23, 2018 Share Posted August 23, 2018 The problem is 7zip does not support what you want to do. However Ketarin allows the use of batch files and C# scripts and can execute any command a batch file would. Therefore you should be able to to do an extraction that would result in a directory structure of "{root}SyMenu\ProgramFiles\ComIntRep_3950" and in the command tab of ketarin issue the command ren ComintRep_3950 "Complete Internet Repair" I haven't tested this but in theory it should work and result in the directory structure of "{root}SyMenu\ProgramFiles\Complete Internet Repair" You might have to play with the commands and it would require a small edit of the ComintRep_xxxx name whenever you updated it unless you could come up with a script/batch file that would use wildcards for the version number. That would be your only automatic fix. Link to comment Share on other sites More sharing options...
Knightmare Posted August 24, 2018 Author Share Posted August 24, 2018 2 hours ago, straycat19 said: The problem is 7zip does not support what you want to do. However Ketarin allows the use of batch files and C# scripts and can execute any command a batch file would. Therefore you should be able to to do an extraction that would result in a directory structure of "{root}SyMenu\ProgramFiles\ComIntRep_3950" and in the command tab of ketarin issue the command ren ComintRep_3950 "Complete Internet Repair" I haven't tested this but in theory it should work and result in the directory structure of "{root}SyMenu\ProgramFiles\Complete Internet Repair" You might have to play with the commands and it would require a small edit of the ComintRep_xxxx name whenever you updated it unless you could come up with a script/batch file that would use wildcards for the version number. That would be your only automatic fix. The wildcard fix is what I'm looking for. Link to comment Share on other sites More sharing options...
debebee Posted August 24, 2018 Share Posted August 24, 2018 Unfortunately for you 7z is doesn't use windows wildcards.. Suggest using rar command line.. Quote Command Line Syntax 7z <command> [<switch>...] <base_archive_name> [<arguments>...] <arguments> ::= <switch> | <wildcard> | <filename> | <list_file> <switch>::= <switch_symbol><switch_characters>[<option>] <switch_symbol> ::= '/' | '-' <list_file> ::= @{filename} Expressions in square brackets (between '[' and ']') are optional. Expressions in curly braces ('{' and '}') mean that instead of that Expression (including braces), the user must substitute some string. Expression expression1 | expression2 | ... | expressionN means that any (but only one) from these expressions must be specified. Commands and switches can be entered in upper or lower case. Command is the first non-switch argument. The "base_archive_name" must be the first filename on the command line after the command. The switches and other filenames can be in any order. Wildcards or filenames with spaces must be quoted: "Dir\Program files\*" Dir\"Program files"\* Switch options can be combined to save command line length. However, some switch options take optional string arguments and therefore, must be the last option in a combined argument token string because 7-Zip accepts the rest of the argument token as the optional argument. 7-Zip uses wild name matching similar to Windows 95: '*' means a sequence of arbitrary characters. '?' means any character. 7-Zip doesn't use the system wildcard parser. 7-Zip doesn't follow the archaic rule by which *.* means any file. 7-Zip treats *.* as matching the name of any file that has an extension. To process all files, you must use a * wildcard. Examples: *.txt means all files with an extension of ".txt" ?a* means all files with a second character of "a" *1* means all names that contains character "1" *.*.* means all names that contain two at least "." characters The default wildcard "*" will be used if there is no filename/wildcard in the command line. Slash ('\') at the end of a path means a directory. Without a Slash ('\') at the end of the path, the path can refer either to a file or a directory. List file You can supply one or more filenames or wildcards for special list files (files containing lists of files). The filenames in such list file must be separated by new line symbol(s). For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding using -scs switch. Multiple list files are supported. For example, if the file "listfile.txt" contains the following: My programs\*.cpp Src\*.cpp then the command 7z a -tzip archive.zip @listfile.txt adds to the archive "archive.zip" all "*.cpp" files from directories "My programs" and "Src". Short and Long File Names 7-Zip supports short file names (like FILENA~1.TXT) in some cases. However, it's strongly recommended to use only the real (long) file names. https://sevenzip.osdn.jp/chm/cmdline/syntax.htm Link to comment Share on other sites More sharing options...
debebee Posted August 24, 2018 Share Posted August 24, 2018 https://www.rarlab.com/download.htm https://www.rarlab.com/rar_add.htm https://www.rarlab.com/rar/unrarw32.exe Quote UNRAR 5.50 x86 freeware Copyright (c) 1993-2017 Alexander Roshal Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...> <@listfiles...> <path_to_extract\> <Commands> e Extract files without archived paths l[t[a],b] List archive contents [technical[all], bare] p Print file to stdout t Test archive files v[t[a],b] Verbosely list archive contents [technical[all],bare] x Extract files with full path <Switches> - Stop switches scanning @[+] Disable [enable] file lists ac Clear Archive attribute after compression or extraction ad Append archive name to destination path ag[format] Generate archive name using the current date ai Ignore file attributes ap<path> Set path inside archive c- Disable comments show cfg- Disable read configuration cl Convert names to lower case cu Convert names to upper case dh Open shared files ep Exclude paths from names ep3 Expand paths to full including the drive letter f Freshen files id[c,d,p,q] Disable messages ierr Send all messages to stderr inul Disable all messages ioff Turn PC off after completing an operation kb Keep broken extracted files n<file> Additionally filter included files n@ Read additional filter masks from stdin n@<list> Read additional filter masks from list file o[+|-] Set the overwrite mode oc Set NTFS Compressed attribute ol[a] Process symbolic links as the link [absolute paths] or Rename files automatically ow Save or restore file owner and group p[password] Set password p- Do not query password r Recurse subdirectories ri<P>[:<S>] Set priority (0-default,1-min..15-max) and sleep time in ms sc<chr>[obj] Specify the character set sl<size> Process files with size less than specified sm<size> Process files with size more than specified ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format tn<time> Process files newer than <time> to<time> Process files older than <time> ts[m|c|a] Save or restore file time (modification, creation, access) u Update files v List all volumes ver[n] File version control vp Pause before each volume x<file> Exclude specified file x@ Read file names to exclude from stdin x@<list> Exclude files listed in specified list file y Assume Yes on all queries or use rar.exe the console utility on the installled directory of winrar Quote RAR 5.60 x64 Copyright (c) 1993-2018 Alexander Roshal 24 Jun 2018 Usage: rar <command> -<switch 1> -<switch N> <archive> <files...> <@listfiles...> <path_to_extract\> <Commands> a Add files to archive c Add archive comment ch Change archive parameters cw Write archive comment to file d Delete files from archive e Extract files without archived paths f Freshen files in archive i[par]=<str> Find string in archives k Lock archive l[t[a],b] List archive contents [technical[all], bare] m[f] Move to archive [files only] p Print file to stdout r Repair archive rc Reconstruct missing volumes rn Rename archived files rr[N] Add data recovery record rv[N] Create recovery volumes s[name|-] Convert archive to or from SFX t Test archive files u Update files in archive v[t[a],b] Verbosely list archive contents [technical[all],bare] x Extract files with full path <Switches> - Stop switches scanning @[+] Disable [enable] file lists ac Clear Archive attribute after compression or extraction ad Append archive name to destination path ag[format] Generate archive name using the current date ai Ignore file attributes ao Add files with Archive attribute set ap<path> Set path inside archive as Synchronize archive contents c- Disable comments show cfg- Disable read configuration cl Convert names to lower case cu Convert names to upper case df Delete files after archiving dh Open shared files dr Delete files to Recycle Bin ds Disable name sort for solid archive dw Wipe files after archiving e[+]<attr> Set file exclude and include attributes ed Do not add empty directories en Do not put 'end of archive' block ep Exclude paths from names ep1 Exclude base directory from names ep2 Expand paths to full ep3 Expand paths to full including the drive letter f Freshen files hp[password] Encrypt both file data and headers ht[b|c] Select hash type [BLAKE2,CRC32] for file checksum id[c,d,p,q] Disable messages ieml[addr] Send archive by email ierr Send all messages to stderr ilog[name] Log errors to file inul Disable all messages ioff[n] Turn PC off after completing an operation isnd Enable sound iver Display the version number k Lock archive kb Keep broken extracted files log[f][=name] Write names to log file m<0..5> Set compression level (0-store...3-default...5-maximal) ma[4|5] Specify a version of archiving format mc<par> Set advanced compression parameters md<n>[k,m,g] Dictionary size in KB, MB or GB ms[ext;ext] Specify file types to store mt<threads> Set the number of threads n<file> Additionally filter included files n@ Read additional filter masks from stdin n@<list> Read additional filter masks from list file o[+|-] Set the overwrite mode oc Set NTFS Compressed attribute oh Save hard links as the link instead of the file oi[0-4][:min] Save identical files as references ol[a] Process symbolic links as the link [absolute paths] oni Allow potentially incompatible names or Rename files automatically os Save NTFS streams ow Save or restore file owner and group p[password] Set password p- Do not query password qo[-|+] Add quick open information [none|force] r Recurse subdirectories r- Disable recursion r0 Recurse subdirectories for wildcard names only ri<P>[:<S>] Set priority (0-default,1-min..15-max) and sleep time in ms rr[N] Add data recovery record rv[N] Create recovery volumes s[<N>,v[-],e] Create solid archive s- Disable solid archiving sc<chr>[obj] Specify the character set sfx[name] Create SFX archive si[name] Read data from standard input (stdin) sl<size> Process files with size less than specified sm<size> Process files with size more than specified t Test files after archiving ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format tk Keep original archive time tl Set archive time to latest file tn<time> Process files newer than <time> to<time> Process files older than <time> ts[m|c|a] Save or restore file time (modification, creation, access) u Update files v<size>[k,b] Create volumes with size=<size>*1000 [*1024, *1] vd Erase disk contents before creating volume ver[n] File version control vn Use the old style volume naming scheme vp Pause before each volume w<path> Assign work directory x<file> Exclude specified file x@ Read file names to exclude from stdin x@<list> Exclude files listed in specified list file y Assume Yes on all queries z[file] Read archive comment from file Link to comment Share on other sites More sharing options...
Togijak Posted August 24, 2018 Share Posted August 24, 2018 With TC you can extract the rar-archives without much manual effort:1. Switch to the archive with CTRL + PAGE DOWN2. Use CTRL + B to display all subdirectory files in a list3. Select and unpack all ZIP files4. Select and unpack the extracted RAR files Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.