1.

Solve : Create a directory with today's date and delete one with yesterday's?

Answer» <html><body><p>An infinitely simpler system would be to NOT delete a folder with a name matching Yesterdays date.<br/>Instead delete ALL folders whose name does not match today's date.<br/><br/>Or even simpler, delete all folders that were not created/modified today.<br/><br/>That not only gets rid of yesterday's folder, but on Monday it will get rid of Friday's folder (assuming a Monday to Friday <a href="https://interviewquestions.tuteehub.com/tag/working-243555" style="font-weight:bold;" target="_blank" title="Click to know more about WORKING">WORKING</a> week).<br/><br/>The only requirement is that these folders must be sub-folders within one one <a href="https://interviewquestions.tuteehub.com/tag/common-923599" style="font-weight:bold;" target="_blank" title="Click to know more about COMMON">COMMON</a> parent folder (and this parent never deleted).<br/><br/>Regards<br/>Alan<br/>SET dwMONTH=%DATE:~4,2%<br/>SET /A dwDAY=%DATE:~7,2%<br/>SET dwYEAR=%DATE:~10,4%<br/>SET dwDate=%dwMONTH%/%dwDAY%/%dwYEAR%<br/>for /<a href="https://interviewquestions.tuteehub.com/tag/f-236701" style="font-weight:bold;" target="_blank" title="Click to know more about F">F</a> "tokens=1" %%a IN (YesterdayDate.txt) DO set yest=%%a<br/>echo %yest%<br/>forfiles /p "." /C "cmd /c if fdate==%yest% rd /q /s fname" &gt; "DeleteDirectoryLog%DATE:~4,2%_%DATE:~7,2%_%DATE:~10,4%.txt"<br/>echo %dwDATE% &gt; "YesterdayDate.txt"After almost 3 years I think the O.P. has now giving up <a href="https://interviewquestions.tuteehub.com/tag/waiting-244830" style="font-weight:bold;" target="_blank" title="Click to know more about WAITING">WAITING</a></p></body></html>


Discussion

No Comment Found