How to Remove Files/Folder Older than X days in Windows using Command Prompt


Often, we need to clean up files and folders that are older than x number of days before they eat up all the disk space.  So we need a script/command to delete the old files/folder.


   1: @echo off

   2: :: set folder path

   3: set target_path=C:\Users\xxxx\AppData\Local\Temp


   5: :: set min age of files and folders to delete

   6: set max_days=7


   8: :: remove files from %target_path%

   9: forfiles -p %target_path% -m *.* -d -%max_days% -c "cmd  /c del /q @path"


  11: :: remove sub directories from %dump_path%

  12: forfiles -p %target_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path"




Install Fresh Windows 10 Pro on Yoga 910


If you want to do a clean install of Windows 10 Professional edition on your Yoga 910, you need to be aware of a few things.  In my case, I am using an iso image from MSDN.

  1. I use Rufus to create a bootable USB flash drive with the Windows 10 Professional iso image. 
  2. I used MBR partition schem for UEFI
  3. I picked File system FAT32
  4. After the USB drive is ready, I created a txt file ei.cfg to USB drive “sources” folder.  ei.cfg has the following content.  This file allows to me to install Professional edition instead of the default choice of Home edition.
  5.    1: [EditionID]

       2: Professional

       3: [Channel]

       4: Retail

  6. I downloaded the storage driver.  I need the driver to see the ssd drive.
  7. Download the  Once unzipped, you should see the following files:
    • iaAHCIC.inf
    • iaStorAC.inf
    • iaStorA.sys
    • iaStorF.sys
  8. I copy these files to the USB drive root folder.
  9. Note: Lenovo support site links to the SetupRST.exe version, which is not what we need.
  10. Then press the tiny Novo button, go to boot menu, select the USB drive to boot.
  11. During the Windows setup, I “Load driver” and choose the storage driver at the USB root folder.

Special thanks to Brad’s hacks guide for the tips.  For me, the Media Creation Tool did not work.  So I used Rufus with my own iso image.

If you create a recovery drive (e.g. USB), you should also put the storage drivers onto it.  You won’t see the drive until you do a work around.  You need to choose the option restore from a system image, which will allow you to load a driver.  Pick iaStoreAC.inf.  Then cancel, now you can recover using the recovery drive.  In my case, it wiped everything.  It did not have the installed windows update nor installed Office 2016.