EmptyTemp — User Command to Empty Windows %Temp%

Please read this entire post before proceeding!

USER COMMAND:
EmptyTemp

PURPOSE:
Empty the Windows %Temp% folder, which by default in Windows XP is a subfolder under each user's profile folder.
Note: This is not the same as emptying Temporary Internet Files.

TEMPLATE:

EmptyTemp METHOD/K[<Delete>,Secure]

USAGE EXAMPLES:[ul]Delete all unlocked files and folders inside current user's %Temp% folder. NOTE: This is the default method.EmptyTemp -or-EmptyTemp METHODSecure Wipe all unlocked files and folders inside current user's %Temp% folder.EmptyTemp METHOD=SECURE[/ul]OPERATION:
Using only Directory Opus RAW commands, EmptyTemp will first open a new lister to the Windows %Temp% folder. EmptyTemp will then select all files and folders inside of the %Temp% folder. EmptyTemp will then either delete the selected objects (if the default Delete method is used) or Securely Wipe them (if the optional Secure Method is used). It is usual for some files to remain, as Windows almost always will have some files that are in-use and locked by running programs. After the files and folders are removed, the lister is automatically closed. The whole process is transparent and viewable, but the user need not interact with it. As can be expected, the Secure Wipe method takes noticeably longer to complete.

Remember EmptyTemp is a User Command not a Toolbar Button
The EmptyTemp command code below is structured differently from most other toolbar buttons posted in this forum. EmptyTemp is a User Command, not a Toolbar Button.

Page 148 of the Directory Opus 8 Manual discusses User Commands and how they differ from Toolbar buttons. For instance, once a User Command is created, it can be used from inside other Toolbar Buttons. If the Command Template is configured correctly, the Command Template Arguments will even show up in the Toolbar Editor's arguments list for that command.

You should also know that Directory Opus User Commands, when exported to a Directory Opus Command File (*.dcf file), appear very much like exported Toolbar Buttons. User Commands, that do not utilize a Command Template, can be exported to a *.dcf file and subsequently dragged directly to a Directory Opus toolbar to create a Toolbar Button, without actually creating the related User Command. IMPORTANT: User Commands that do utilize a Command Template (like EmptyTemp) cannot be directly dragged to a toolbar as doing so will create a Toolbar Button with no Command Template, and will break the intended functionality of the command.

HOW TO CORRECTLY GET THE COMMAND TO YOUR DIRECTORY OPUS CONFIGURATION:[ul]1. Create the two .dcf files from the posted code below (or extract them from the attached .zip file).
1.A Open Notepad and paste the code below and save the file to your Desktop as EmptyTemp-UserCommand.dcf. This is the EmptyTemp User Command.<?xml version="1.0"?> <button display="icon" effect="gray"> <guid>{5F943848-8E14-4388-B85B-69AE3A14C79B}</guid> <label>EmptyTemp</label> <tip>Delete all unlocked files and folders from the current user's %Temp% folder.</tip> <template>METHOD/K[&lt;DELETE&gt;,SECURE]</template> <icon1>%SystemRoot%\System32\shell32.dll,63</icon1> <function type="normal"> <instruction>Go %Temp% NEW=source </instruction> <instruction>Select ALL </instruction> <instruction>Delete NORECYCLE QUIET ALL FORCE &amp;METHOD&amp;</instruction> <instruction>Close WHENFINISHED </instruction> </function> </button>
1.B. Open Notepad and paste the code below and save the file to your Desktop as EmptyTemp-2-Button.dcf. This is a 2-button toolbar button that utilizes the EmptyTemp User Command in two different ways (LMB=Delete, RMB=Secure Wipe).<?xml version="1.0"?> <button display="icon" effect="gray" type="three_button"> <guid>{2FBAB539-8750-4386-84FE-550F1057C0C7}</guid> <label>EmptyTemp 2-Button</label> <tip>This is a 2-Button Toolbar button using the EmptyTemp User Command</tip> <icon1>%SystemRoot%\System32\shell32.dll,63</icon1> <button display="both" effect="gray"> <guid>{EC602C6E-1547-47D1-A394-702C43874D7C}</guid> <label>Empty %Temp%</label> <tip>Delete all unlocked files and folders from the current user's %Temp% folder.</tip> <icon1>%SystemRoot%\System32\shell32.dll,63</icon1> <function type="normal"> <instruction>EmptyTemp </instruction> </function> </button> <button display="both" effect="gray"> <guid>{A027D1D8-955E-4605-87CD-AA7C3F95E386}</guid> <label>Empty %Temp% Secure</label> <tip>Delete all unlocked files and folders from the current user's %Temp% folder, using Secure Wipe.</tip> <icon1>%SystemRoot%\System32\shell32.dll,63</icon1> <function type="normal"> <instruction>EmptyTemp METHOD=SECURE </instruction> </function> </button> </button>
2. Put Directory Opus in Customize Mode.
3. Click on the Customize > Commands Tab.
4. Click on the User Category.
5. Drag EmptyTemp-UserCommand.dcf to the User Commands list.
6. Drag EmptyTemp-2-Button.dcf to any toolbar.[/ul]Don't Forget About Directory Opus Hotkeys! (Optional)
For Hotkey fanatics (like me), I recommend just creating the EmptyTemp User Command and then creating two System-Wide Directory Opus Hotkey entries, instead of (or in addition to) the Toolbar Buttons. I recommend the following hotkey sequences:

[code]Description: Command: Sys-Wide: Hotkey Sequence:

Empty %Temp% of unlocked objects EmptyTemp Yes Win + Ctrl + Delete
Empty %Temp% of unlocked objects Secure EmptyTemp METHOD=SECURE Yes Win + Ctrl + Shift + Delete[/code]
NOTE: I also define:

[code]Description: Command: Sys-Wide: Hotkey Sequence:

Delete selected objects to Recycle Bin Delete No Delete
Delete selected objects skip Recycle Bin Delete NORECYCLE No Shift + Delete
Delete selected objects Secure Wipe Delete SECURE No Ctrl + Delete
Empty Recycle Bin Delete EMPTYRECYCLE Yes Win + Delete

[/code]
I hope you find this useful :smiley: and educational! :bulb:
EmptyTemp.zip (3.4 KB)

I should point out, that I created the above command because I wanted to review the process while the %Temp% folder was being emptied. If you merely want to delete everything in the temp folder without the visual review in a separate lister, use either command below in a hotkey or a toolbar button.

FAST DELETE:

Delete NORECYCLE QUIET ALL FORCE FILE="%Temp%\*"

SECURE WIPE:

Delete SECURE QUIET ALL FORCE FILE="%Temp%\*"

NOTE: You may not always see a progress dialog with these commands (if %Temp% has very few files), so sometimes there is no visual indication that the process is complete.

IMPORTANT: If you do not use either the SECURE or NORECYCLE option, then everything in the %Temp% folder will end up in the Recycle Bin.

Deleting everything in the temp folder can be dangerous. A program may have written files there which it's going to use but doesn't currently have open and it could go wrong if they're not there.

You can usually get away with it but if you want to be on the safe side it's a good idea to only delete files which are a few days old, unless you can tell they're from a program that is no longer running.

I'm usually even more paranoid than that and only delete files modified before the last time I rebooted.

I think you could use a filter with the delete command so that recently created/modified files aren't deleted.

All good points. I typically only delete between installs and such (after all other software except for Opus is shut down). I usually need %Temp% empty so I can see what the next install software is unpacking so I can grab it and make a silent install out of it (like Opus for example).

hoi,

i installed your emptytemp button/config.
after clicking on the button, a new window shows up.
but it deletes all of my mp3 instead the temp folder...
the mp3 folder was selected as source! by open a new window...
maybe it sould be better selected the temp folder as source?

maybe i did something wrong by the install or there is a bug in your settings?
i downloaded the zip-file, drag the command file into the command user window and the button file on my toolbar...

any suggestions to undelete my mp3 files? :confused:

i use dopus 8.2.2.4U german
i hope you can read my english :slight_smile:

thx
greets
robert

Eek!

Restoration is a good, free undelete tool although I don't know how good it'll be for undeleting a lot of files at once. It's the only one I've used though and it has worked well for me in the past:

snapfiles.com/get/restoration.html

thx!

it worked :slight_smile:
cool tool!
it is good that i did not use the secure delete button :laughing:

greetings
robert

I'm sorry you had files deleted. No one else has ever reported a problem with this button, and its been posted up here on this thread for at least a few months now. I have also used this button for a couple of months before posting it here.

EmptyTemp opens its own lister to the %Temp% Folder, and closes it when it's finished. Do not click on another Opus lister window until that EmptyTemp's lister closes. Otherwise, you will change the lister that has the focus, and when EmptyTemp does a Select All, and the subsequent Delete command it will do it in the lister you clicked on.

If you want a safer way to run it, open one and only one lister to My Computer, and click the button then (you cannot delete anything from My Computer).

Also, you said you are using the German version of Opus. Are you also using a German version of Windows? Is the %Temp% environmental variable named something different in the German language? If, so then you must edit the EmptyTemp user command to the appropriate variable name.

hoi

strange. now it works. maybe i configured too mutch yesterday in dopus and after a reset, it seems to be work ok :slight_smile:
the %temp% variable is the same here in the german windows.

i have an eye on this and hope it works now for safe :slight_smile:

greetings
robert