Jump to content
Ketarin forum

Extract Files, Move Files Then Delete Folder


Zalbag
 Share

Recommended Posts

Sorry for bothering you again, but I have three questions. The first is; how to extract the files then I want to move the files to a specific location then I want to delete the folder that the zip/7z created.

 

Step 1: 7z x -y -o"C:\Program Files\Launchbox\Emulators\Dolphin\Updates" "{file}"

Step 2: (Move files) or (Rename folder that is extracted and overwrite files in location)?

Step 3: rd /s /q "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-x64" "{file}"


My next question is; I assume when you extract the files to a location with the existing files it will automatically overwrite those files, right?

 

My last question is; do you only need Uniextract if 7-Zip can’t extract a certain file extension? It seems to work fine for 7z/zip.

Link to comment
Share on other sites

What is your ultimate goal in steps 1 through 3? Are you trying to only extract a portion of the files, or are you trying to exclude only that one folder, or are you trying to accomplish something else? The syntax in step one can be adjusted to exclude the Dolphin-x64 folder by adding -x"Dolphin-x64" thus eliminating the need for steps 2 and 3. You could also use a second 7z call to extract only a portion of the contents with -i in order to effect step 2.

The issues you might face, as this is extracting to the Program Files folder, is permission to write and propagation of permissions to the folder after the write. 

The "-y" in your 7z command means "overwrite".

"7z vs uniextract vs winzip vs some other compression utility" is really a matter of personal taste and syntax. Other than that, there's very few differences in most compression tools today.

Link to comment
Share on other sites

Well I just turned off my computer yesterday night and turned it back on when I got home from work and now the commands/scripts that I got previously to work for extracting the file aren't working anymore. It's almost like it can't find 7-Zip anymore for some strange reason. I've tried reinstalling 7-Zip both 32/64 bit, adding it to the exception list in firewall and turning off my Anti-Virus (ESET Nod32 Antivirus). I’ve tried two different commands for multiple zip/7z files but it’s still isn’t working with Ketarin, any idea? I am also using Windows 7 64-bit operating system.  

Anyways to answer your previous question when you download Dolphin from https://dl.dolphin-emu.org/builds/dolphin-master-5.0-8251-x64.7z and you extract it, it comes in a folder named Dolphin-x64. I want the files inside the folder to overwrite the location. I don’t want the folder named Dolphin-x64.

I have the downloaded file set to download here: C:\Program Files\Launchbox\Emulators\Dolphin\Updates\dolphin-master-5.0-8251-x64.7z & I want to extract it to this location C:\Program Files\Launchbox\Emulators\Dolphin. So, when I had the previously command/script working it would place the folder named Dolphin-x64 into that location rather than overwriting the files. Like I stated previously I don’t want the folder just the files inside the folder to overwrite.

This command doesn’t seem to work anymore in extracting the file, I don’t believe I did anything wrong.

7z x -y -o"C:\Program Files\Launchbox\Emulators\Dolphin" "{file}"

 

I’ve also tried a similar command with BGB

7z x -y -r -o"C:\Program Files\Launchbox\Emulators\BGB" "{file}" *.exe *.dll

Link to comment
Share on other sites

Just got back home from work and the variable method worked wonderfully. I didn't even know there were internal settings let alone the log files which really helps pinpoint the problem. Here's a copy of the log file in case you're wondering. 

7/20/2018 5:49:27 PM: Advanced Renamer: Executing command: 7z x -y -o"C:\Program Files (x86)\advanced_renamer_portable\Updates" "C:\Program Files (x86)\advanced_renamer_portable\Updates\advanced_renamer_portable.zip"
7/20/2018 5:49:27 PM: Advanced Renamer: Command result: Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
C:\Program Files (x86)\Ketarin-1.8.9>7z x -y -o"C:\Program Files (x86)\advanced_renamer_portable\Updates" "C:\Program Files (x86)\advanced_renamer_portable\Updates\advanced_renamer_portable.zip"
'7z' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files (x86)\Ketarin-1.8.9>

I got the variable method to work though, so I'll stick to using that for now on. Oh and I don't know if it's just my 7-Zip but the exe is now called 7zG.exe. This software is literally godlike. You guys did an amazing job, thanks a lot and keep up the great work.

Link to comment
Share on other sites

I still need help though with that unnecessary folder though I've tried the -x"Dolphin-x64" method listed above and it doesn't seem to work. I assume that would delete the folder before it extracts the files? I think I have to use the wildcard support method and I've gone to the link but it's confusing. Does it only work for Linux operating systems? Like I don't see a download link for the software or is it even software? Folders don't have extensions so I am a little confused on how I would do this. Also for programs like MusicBee where the name constantly changes based on the version, I'd assume I'd enter the rename command after the file is downloaded and rename it to whatever. Anyways, thanks a lot this program and your support is amazing.

"{7z}" x "{file}" -o"C:\Program Files\Launchbox\Emulators\Dolphin\Updates" -y
ren "{Dolphin-x64}" Dolphin

Link to comment
Share on other sites

okay - so the problem is that the distribution packages it all in a "Dolphin-x64" subfolder. This is called a 'root folder' in distribution terms and would normally be bypassed by using the "-spe" parameter of 7-zip. Unfortunately, the download file name is inconsistent with the spe behavior, and my attempts to make it work have failed. I am not operating at 100% right now, so my recommendation would be to continue with the renaming procedure you're using right now. Almost. Use this variation instead:

ren "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-x64" Dolphin

 

Link to comment
Share on other sites

So, it worked I had to use two custom scripts but it won’t let me overwrite the folder. It says "A duplicate file name exists, or the file cannot be found." I've tried placing a /y & -y at different locations but it says "The syntax of the command is incorrect." I assume the overwrite command doesn’t work in the same context as renaming the folder? In order to correctly overwrite the file is there a Cut/overwrite command? Also, just out of curiosity are these scripts/commands are they the same from DOS & 7-zip? I remember doing something similar as a kid when I use to play Warcraft 1 through DOS. Thanks and sorry for so many questions...

 

"{7z}" x "{file}" -o"C:\Program Files\Launchbox\Emulators\Dolphin\Updates" -y

ren "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-x64" Dolphin

Cut folder “Dolphin” to “C:\Program Files\Launchbox\Emulators” & overwrite

 

OR Copy folder “Dolphin” to “C:\Program Files\Launchbox\Emulators” & overwrite

del /s /q "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin"

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Yes, this is all pretty much what you'd be typing at a command prompt.

Maybe what you're after is robocopy or xcopy to overwrite only the older files from the archived copy to the new copy? Assuming you're running a backup first. Something like this:

move "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin" Dolphin-backup
"{7z}" x "{file}" -o"C:\Program Files\Launchbox\Emulators\Dolphin\Updates" -y
move "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-x64" Dolphin
robocopy "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-backup" "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin" /w:1 /r:1 /e /xo
del /s /q "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-backup\*.*"
rd /s /q "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-backup"

The above *should* rename the original Dolphin folder to Dolphin-backup, extract to Dolphin-x64, rename Dolphin-x64 to Dolphin, copy your preferences and the files that are newer (such as cache files) from Dolphin-backup to Dolphin, then purge and remove Dolphin-backup.

Untested, but should work. :)

Link to comment
Share on other sites

So, I’ve tried the code you’ve recommended and unfortunately the script: move "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin" Dolphin-backup doesn’t work it says Access denied in the log. However, thanks to you I was able to get it to work by using 3 different scripts:

"{7z}" x "{file}" -o"C:\Program Files\Launchbox\Emulators\Dolphin\Updates" -y

ren "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin-x64" Dolphin

robocopy "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin" "C:\Program Files\Launchbox\Emulators\Dolphin" /w:1 /r:1 /e /xo

del /s /q "C:\Program Files\Launchbox\Emulators\Dolphin\Updates\Dolphin

Thanks a lot for your reply and keep up the great work.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.