By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!In the particular case of "DO var in @clip: (...)" can't the temp file be deleted at the same time that it's closed, as happens in the case of "DO var in /P command (...)"? As I see it (maybe oversimplifying) in both cases the file only exists for the sake of the DO commandBecause there's no such device as "clip:". TCC fakes it with temporary files, but the creation of the clipboard temporary file and the point at which it *might* be deleted (wouldn't work in any case in pipes) are far apart (and different in every internal command that supports clip:) and there's no practical way to communicate that the temp file might be deletable now.
JPS-CIN-xxxx-yyyyyyyy.TMP
In the particular case of "DO var in @clip: (...)" can't the temp file be deleted at the same time that it's closed, as happens in the case of "DO var in /P command (...)"? As I see it (maybe oversimplifying) in both cases the file only exists for the sake of the DO command
Well I didn't know how it works (still don't really). It's no big deal. I've been a bit obsessed with %TEMP lately because DevStudio Community has a "BackgroundDownload" task which runs ~20 times a day (I think it's misconfigured) and really leaves a mess in %TEMP.DO doesn't know it's a temp file; all it knows is that it's reading from STDIN. The parser redirected everything before DO saw the command line.
I could probably do what you want; it just requires rewriting the parser. Probably a 2x- 3x increase in size and a corresponding decrease in performance. And so, so many new bugs ...
It does not "bother" me, if that was a reply in my address. I was honestly interested in the implementation details.If it really bothers you, you should stop posting messages and close your browser, which produces far more files in your temp directory (and never deletes them).
I've been a bit obsessed with %TEMP lately because DevStudio Community has a "BackgroundDownload" task which runs ~20 times a day (I think it's misconfigured) and really leaves a mess in %TEMP.
What I'd like to do with a batch file is what I do manually and I don't think it's possible.Write a batch file to delete everything over, say, five days old in %TEMP. Then either use Task Scheduler to run it once a day, or local group policies to run it at login.
v:\> d t:\
2019-10-03 13:58 <DIR> 2nkiplrq.itg
2019-10-03 13:19 <DIR> g0k53vbe.t2n
2019-10-03 12:44 <DIR> Offline Address Books
2019-10-03 21:33 <DIR> Outlook Logging
2019-07-02 11:58 <DIR> System Volume Information
2019-10-03 13:19 <DIR> VSRemoteControl
2019-10-03 13:58 <DIR> wdszp4so
2019-10-04 09:23 12,308 AdobeARM.log
2019-10-04 06:46 470 aria-debug-2544.log
2019-10-03 13:19 2,909 dd_BackgroundDownload_20191003131952.log
2019-10-03 13:19 0 dd_BackgroundDownload_20191003131952_result_Cancel.log
2019-10-03 13:58 386,627 dd_BackgroundDownload_20191003135812.log
2019-10-03 13:58 381,455 dd_BackgroundDownload_20191003135812_00_setup.log
2019-10-03 13:58 0 dd_BackgroundDownload_20191003135812_00_setup_errors.log
2019-10-03 13:58 0 dd_BackgroundDownload_20191003135812_result_Success.log
2019-10-02 11:41 4,194,332 ExchangePerflog_8484fa31d2e07ce7cfcccd43.dat
2019-07-04 00:35 0 FXSAPIDebugLogFile.txt
2019-10-02 11:41 0 mat-debug-6528.log
2019-10-03 15:29 3,087 Olktmp.png
2019-10-03 16:23 3,087 Olktmp00.png
2019-10-03 15:25 20,561 wct99C6.tmp
2019-10-03 01:55 20,527 wct8942.tmp
v:\> d t:\
2019-07-02 11:58 <DIR> System Volume Information
2019-10-02 11:41 4,194,332 ExchangePerflog_8484fa31d2e07ce7cfcccd43.dat
2019-07-04 00:35 0 FXSAPIDebugLogFile.txt
2019-10-02 11:41 0 mat-debug-6528.log
What I'd like to do with a batch file is what I do manually and I don't think it's possible.
Maybe it doesn't. I was always a little afraid to automate it is such a drastic manner. I'll try it when %TEMP gets messy again.Seriously, though. How does that differ from DEL /S /E /X /Y /Z * ?
Is there (has there ever been) any newer stuff that you're sure had some value?Just checked my own cleanup batch file, and it deletes anything over 14 days old. Two weeks seems almost ludicrously conservative; two days would probably do just as well. But 2 days or 14, it all gets deleted eventually.
As far as I'm concerned, anything in the temp directories is ipso facto temporary. I certainly don't keep important stuff there.Is there (has there ever been) any newer stuff that you're sure had some value?
Just checked my own cleanup batch file, and it deletes anything over 14 days old. Two weeks seems almost ludicrously conservative; two days would probably do just as well. But 2 days or 14, it all gets deleted eventually.
C:\>type c:\Bin\Bat\PurgeTempDirs.btm
@echo off
*setlocal
*unalias *
rem This script deletes any files over two weeks old from
rem the user's temp directory and C:\WINDOWS\TEMP.
set n=14
alias purge=`if .%1 ne . if isdir %1 pushd %1 && ( del /[dc-%n,1980-01-01] /s /e /x /y /z * %+ popd )`
purge "%temp"
purge "%systemroot\temp"
endlocal
quit
C:\>
Yes, that works nicely and apparently does exactly what my manual method does. I found that prefixing that command withHmmm. What's needed is some sort of a scriptable file-management tool. Somebody should write something like that....
Seriously, though. How does that differ from DEL /S /E /X /Y /Z * ?
except (cleantmp.btm) ...
set h=%@fileopen[t:\cleantmp.btm,rw]
DEL /S /E /X /Y /Z t:\*
echo %@fileclose[%h] > NUL
Yes, that works nicely and apparently does exactly what my manual method does. I found that prefixing that command with
doesn't protect cleantmp.btm. But that was easy to fix ... like this.Code:except (cleantmp.btm) ...
Code:set h=%@fileopen[t:\cleantmp.btm,rw] DEL /S /E /X /Y /Z t:\* echo %@fileclose[%h] > NUL
touch /dc2199-12-31 readme.txt
Have you found a solution to this? or is it not bothering you in 2021 ?What I'd like to do with a batch file is what I do manually and I don't think it's possible.
I open explorer in %TEMP, press Ctrl-A (select all), press Shift-Delete (delete permanently) and answer "Skip it" for each item (usually 4 of them) that gives any sort of a prompt. That process turns this:
Code:v:\> d t:\ 2019-10-03 13:58 <DIR> 2nkiplrq.itg 2019-10-03 13:19 <DIR> g0k53vbe.t2n 2019-10-03 12:44 <DIR> Offline Address Books 2019-10-03 21:33 <DIR> Outlook Logging 2019-07-02 11:58 <DIR> System Volume Information 2019-10-03 13:19 <DIR> VSRemoteControl 2019-10-03 13:58 <DIR> wdszp4so 2019-10-04 09:23 12,308 AdobeARM.log 2019-10-04 06:46 470 aria-debug-2544.log 2019-10-03 13:19 2,909 dd_BackgroundDownload_20191003131952.log 2019-10-03 13:19 0 dd_BackgroundDownload_20191003131952_result_Cancel.log 2019-10-03 13:58 386,627 dd_BackgroundDownload_20191003135812.log 2019-10-03 13:58 381,455 dd_BackgroundDownload_20191003135812_00_setup.log 2019-10-03 13:58 0 dd_BackgroundDownload_20191003135812_00_setup_errors.log 2019-10-03 13:58 0 dd_BackgroundDownload_20191003135812_result_Success.log 2019-10-02 11:41 4,194,332 ExchangePerflog_8484fa31d2e07ce7cfcccd43.dat 2019-07-04 00:35 0 FXSAPIDebugLogFile.txt 2019-10-02 11:41 0 mat-debug-6528.log 2019-10-03 15:29 3,087 Olktmp.png 2019-10-03 16:23 3,087 Olktmp00.png 2019-10-03 15:25 20,561 wct99C6.tmp 2019-10-03 01:55 20,527 wct8942.tmp
into this:
Code:v:\> d t:\ 2019-07-02 11:58 <DIR> System Volume Information 2019-10-02 11:41 4,194,332 ExchangePerflog_8484fa31d2e07ce7cfcccd43.dat 2019-07-04 00:35 0 FXSAPIDebugLogFile.txt 2019-10-02 11:41 0 mat-debug-6528.log
No, and I stopped looking. I keep the BTM elsewhere and clean up 3 temp directories withHave you found a solution to this? or is it not bothering you in 2021 ?
If interested I altered one of your scripts to clean the temp folder works great
DEL /S /E /X /Y /Z %_cwds*
fair enoughNo, and I stopped looking. I keep the BTM elsewhere and clean up 3 temp directories with
Code:DEL /S /E /X /Y /Z %_cwds*
in each one. As much as can be deleted is deleted and I don't worry about what's left.