Can someone help me with a button?

I tried something already, but it didn´t work perfectly anyhow (i guess, i had it a bit wrong).

Very simple task:

go C:\Dokumente und Einstellungen\ab\Anwendungsdaten\Sandbox\DefaultBox\drive\F\Programme\Opera\profile\cache4

and delete .

and goto

C:\Dokumente und Einstellungen\ab\Lokale Einstellungen\Anwendungsdaten\Google\GoogleEarth

and delete dbcache (if existing)

all without query. How would the correct commands be?

I assume you don't really want to navigate to the directories and only want to delete the files in them. If that's correct then this should be all that you need:

delete "C:\Dokumente und Einstellungen\ab\Anwendungsdaten\Sandbox\DefaultBox\drive\F\Programme\Opera\profile\cache4\*"

delete "C:\Dokumente und Einstellungen\ab\Lokale Einstellungen\Anwendungsdaten\Google\GoogleEarth\*dbcache*"

[quote="nudel"]I assume you don't really want to navigate to the directories and only want to delete the files in them. If that's correct then this should be all that you need:

[/quote]

I was just about to ask a similar question, one you already have answered in part.

In addition to OP's question I have 2 additional as the Delete command seems rather limited when it comes to recurse (or not).

How would I:
delete *.tds in c:\bpl6 and all subdirs
delete *.#<number, upto 99> in only c:\program files\borland\cbuilder6\lib

This question should cover most of what isn't too obvious with the delete command, as it isn't any arguments to specify recurse or not, etc..
At least not according to the reference manual.

I have no interest in visiting the locations, just remove the specified files (those are temp/unneeded files).

Thank you kindly for all help.

You can use a Delete Filter (or two) to do both of those. Don't have time to explain it step-by-step right now though.

PHPBB_IMPORT_WARNING CODE_NEAR_LI

Edit: I'll take the time for nudel since he always spends the time on everything else :wink:

Go to Settings->Preferences->File Operations->Filters and:

a) For your question about deleting *.tds files under all folders below C:\bpl6:

Add a new filter named tds that specifies simply:
[ul][li]Name[/li]
[li]Match[/li]
[li]*.tds[/li]
[li]Use wildcards[/li][/ul]Create a button or hotkey that runs the command: Delete "C:\bpl6" FILTER=tds

b) For your question about deleting all *.## files up to ##==99:

Add a new filter named ddext that specifies:
[ul][li]Name[/li]
[li]Match[/li]
[li]s.([0-9][0-9])[/s]
Edit: to avoid the pattern matching problem mentioned below use instead^(.*)\.([0-9][0-9])$[/li][/ul][ul][li]Use regular expression[/li][/ul]
Create a button or hotkey that runs the command: Delete "c:\program files\borland\cbuilder6\lib*" FILTER=ddext

REALLY IMPORTANT NOTE: while the actual names of the filters above don't make any difference, MAKE SURE that whatever names you DO use when creating the filters are the exact same names you use along with the actual Delete commands. If the filter name is not recognized, then entire files or folders will be deleted... be wary of using names with spaces in them - or use quotations where necessary.

WOOPSY !!!

I just realized two problems with the second command above...

One is probably just a side effect of the delete filespec being evaluated before the filter logic... and causes the delete confirmation dialog to come up claiming it will delete however many files are in the target directory even if none of them match the pattern and none even get deleted. Not a big deal, but misleading.

The other is more severe... even though I would have thought that the b[/b] pattern would have matched only files with a two-digit extension... files with three-digit extensions are being matched and deleted also. Not sure what is up with that... seems wrong to me, but I'm not a regex or Opus pattern matching guru by any stretch.

JohnZ... Ken... anybody???

Try ^(.*).([0-9][0-9])$ for the second regular expression. Regexps may match sub-strings unless you force them not to.

Good looking... that patches things up well. Oh well, tried to save you the time... :laughing:

[quote="steje"]

REALLY IMPORTANT NOTE: while the actual names of the filters above don't make any difference, MAKE SURE that whatever names you DO use when creating the filters are the exact same names you use along with the actual Delete commands. If the filter name is not recognized, then entire files or folders will be deleted... be wary of using names with spaces in them - or use quotations where necessary.[/quote]

Thank you both for the pointers.. I'll try this.

About the warning..
If this is correct, then the behavior really should be corrected/changed to either ignore a delete (and similar destructive commands) command containing a nonexistent filtername, or ideally pop up a dialog saying it couldn't run it because the 'filtername' filter is missing.

Otherwise I guess this could be a potential disaster (accidentially delete/rename a filter without correcting the command, and potentially the entire drive could be gone if ran with the delete command).

Agreed. I've filed a change request with GPSoft along those lines.

Yeah, when I realized that was the case while testing the button I typed up a change request as well but hadn't submited it yet... Won't bother now.

[quote="nudel"]I assume you don't really want to navigate to the directories and only want to delete the files in them. If that's correct then this should be all that you need:

[code]
delete "C:\Dokumente und Einstellungen\ab\Anwendungsdaten\Sandbox\DefaultBox\drive\F\Programme\Opera\profile\cache4*"

delete "C:\Dokumente und Einstellungen\ab\Lokale Einstellungen\Anwendungsdaten\Google\GoogleEarth*dbcache*"

[/code][/quote]

ah, thank you very much! Is there any way to avoid the "are you sure.." question, like NOQUERY or something like that? Not that it would be too important, but would be nice.

Add QUIET to suppress the confirmation prompts, FORCE to suppress prompts for read-only files, and NORECYCLE to permanently delete rather than going through the recycle bin. You could also try reading the manual where these and thousands of other wonderful arguments are documented :slight_smile:

yeah, thx. I will try that right now.

yeah, thx. I will try that right now.[/quote]

Where do i have to place that argument?
all three

QUIET delete path
delete QUIET path
delete path QUIET

did not work. thx!

:cry:

delete path QUIET 

Worked perfectly for me. More specifically here is the exact button command I used (with my test folder).

Delete "D:\test folder\iTunes\*" QUIET 

[quote="JohnZeman"]delete path QUIET

Worked perfectly for me. More specifically here is the exact button command I used (with my test folder).

Delete "D:\test folder\iTunes\*" QUIET 

lol, now i know. It was in -> settings -> file operations - deleting files, 2nd check from the top had to be disabled, off course. This is very logical.