Help on buttons for deleting windows backups in DOS

Following two codes i´d like to have as DOS commands. They must be run in admin mode (password requested). So when having the item selected, which is to be deleted, it would act as the path argument (red part). Maybe it is {f}?

takeown /F C:\Windows.old* /R /A
rmdir /S /Q [b]C:\Windows.old[/b]

So this is what i want:

  • select dir that is to be deleted
  • run command 1, type password
  • run command 2 on selected item

This is for deleting WindowsImageBackup Files. One thing is a bit strange about those files, no file manager seems to be able to show the size of that folders. :frowning:

takeown /F {f}\* /R /A
rmdir /S /Q {f}

That should work.

The file size thing is probably because permissions on the folder are set to deny you read access.

Yeah, cool, that works, thanks. But i forgot, there are also those Medial.bin files, which won´t be deleted since they´re no folders. Can you also include any type of item, like simple files?

Not sure what you mean? The rmdir /S should delete the whole folder including any contents.

Yep, it does, but this seems to be some accompanying single file outside the folder & isn´t affected by the rmdir.

Where is it in relation to the folder?

In the same level, eg. the backup File is a folder M:\Image (several gigs large), there is the file M:\medial.bin, that is created with the backup file, so it needs also to have the owner rights changed in order to be deleted.

takeown /F {sourcepath}\medial.bin /A
del /F {sourcepath}\medial.bin
takeown /F {f}\* /R /A
rmdir /S /Q {f} 

Yep, works now. Thanks Jon! :sunglasses:

This is for deleting WindowsImageBackup Files. One thing is a bit strange about those files, no file manager seems to be able to show the size of that folders. :frowning:[/quote]
If you open the folder and all subfolders, you can see the size after closing the folders.
Analogously, when you try to copy (up to do 10.005) you get the message "access denied", no UAC prompt is shown.
If you open the folder and it's subfolders, you get the prompt for each folder, elevate each time, and THEN you can copy without additional UAC prompt.
I hope with version 10.006 the prompt appears before opening the folders. Open 'n copy is not the big "blockbuster", if you just want to copy.

Note that doing that will modify the file/folder permissions/ownership on the backup folder to allow your (non-elevated) account to read the folders.

(Opus doesn't just elevate to admin to read the folder; it elevates to admin to take ownership of the folder, then reads the folder using normal permissions. I think Explorer does the same. In theory both programs could try to read the folder using elevation first, but they don't for whatever reason (which may just be historical; the permissions/ownership problem existed before UAC so this mechanism in Explorer probably pre-dates UAC and it never seemed worth updating it to first try reading with elevation (which could still fail & require permission changes in the end)).)

the next version (06) will "copy" handle like Win explorer?

Supplement : when i copy with win expl, i elevate and explorer copies.
Then trying to copy with do , same game : access denied. Therefore nothing changed with ownership

I've added it to the to-do list, but since there are plenty of workarounds and it's such a rare situation to need it at all, it might take us a while to get to it.

These workarounds are not satisfying. And yes it's rare, but nevertheless it's annoying if a (not cheap) piece of professional software has not settled basic
things, with which even freeware explorers don't have any problem. (UE, CubicE). And i want to work with ONE explorer, and do not want to be compelled
to use winexp, or to have a lot of uac dialogs . (Not even in rare situations).
Perhaps they tackle the uac topic in a general other (better?) way so that they do not have to consider explicitly exotic folders.

I'd say for most other situations, Opus handles UAC far better than any other file manager (that I'm aware of at least).

It's not perfect, and this situation isn't handled as well as it could be, and I can understand that annoys you.

I had a look at how other file managers handle copying a similar folder.

Total Commander just creates an empty folder in the destination and silently fails to copy any of the contents.

XYplorer and Xplorer2 (and I'm guessing the ones you mention, though I didn't try them) do let you copy it, after some UAC prompts, the same as Explorer, but it's not because they've done something special to handle the situation; it's because they don't have their own copy functionality and use the Windows shell to do everything. Great for this one situation, lacking in many others.

I could easily make you a button in Opus which copies the selected folder(s) using the Windows shell copy functionality if you want that? Clicking that button would copy the folder using exactly the same code that the other file managers (except Total Commander) are using.

Or you can wait for us to improve the way Opus's own copy functionality handles this one situation, but that probably won't happen overnight. Please remember that Opus is written for thousands of people, not just for you, so while this may be really important to you it has to be weighed up against lots of other things that are important to others. That doesn't mean it won't happen.

Thanks for your research, and yes that would be an intermediate solution; thank you!!

Ok, i wait for it.

First, download the NirCmd.exe util and copy it to [b]C:\Program Files\NirCmd[/b] (or wherever you want if you modify the button below accordingly).

Then make a button (or hotkey or whatever) in Opus which runs this command:

@sync:"C:\Program Files\NirCmd\nircmd.exe" shellcopy {filepath$} {destpath$}