Jump to content
Ketarin forum

rd command wildcard support


Knightmare
 Share

Recommended Posts

I'm trying to figure out how to delete a subfolder that is created when I download FixWin 10. I have the program set to extract the zip folder into a FixWin folder that I have created using the 7z e command to ignore the original structure; however, if a new version is released, the folder named after the version, so I'm left with an empty folder in my FixWin folder with the version name. Currently, it is 10.0.1.0. If a new version comes out, then the name of that folder will change and when I update, I believe that I will have two empty folders: one with the old version name and the other with the new version name. I would like to delete the empty folder during extraction but I don't know how to do that. Any help?

 

Ketarin_2018-07-15_17-40-57.png

Link to comment
Share on other sites

i've never used FixWin. are there subfolders below the versioned folders? such as "10.0.1.0\something\file.ext"? if not, then you can just extract the entire contents of the zip file into the FixWin folder, overwriting with new data. your first post-download command should be doing that already:

7z e "{file}" -o"{root}SyMenu\ProgramFiles\FixWin" -y 

that said, you could always use a for loop to do it instead:

for /f "delims=" %%d in ('dir "{root}SyMenu\ProgramFiles\FixWin" /s /b /ad ^| sort /r') do rd "%%d"

or robocopy:

ROBOCOPY "{root}SyMenu\ProgramFiles\FixWin" "{root}SyMenu\ProgramFiles\FixWin" /S /MOVE

good luck!

Link to comment
Share on other sites

There are not any subfolders; however, when the zip file contains the files in a folder. When I do 7z e, it takes out the contents of the folder and puts them in the FixWin folder that I have along with the folder that it emptied:

Bandizip_2018-07-18_23-29-36.thumb.png.a534fba45a0525f68d304a20e48d4536.png

When I unzip it with the commands that I show in my first post, I get this:

explorer_2018-07-18_23-31-20.thumb.png.f37daf7d5477c5aec7f5a513a5400ef1.png

Since I don't need the Internet shortcut or the Text Document, my work around is this:

7z e "{file}" -o"{root}SyMenu\ProgramFiles\FixWin\" *.exe *.dll -r -y

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.