write a batch file to remove the folders by date and time wise

后端 未结 2 473
后悔当初
后悔当初 2021-01-14 06:55

Exact Duplicates:

  • How to write a batch file to delete the files which are 5 days or older from a folder?
  • write a batch file to delete 6 days older f
2条回答
  •  滥情空心
    2021-01-14 07:44

    The only way I know that I know that what you are trying to do might be possible is using the for command and the ~t expanding parameter.

    for %r in (*.*) DO echo %r "created on" %~tr
    

    That produces:

    C:\>echo BOOTSECT.BAK "created on" 2009/02/17 11:59 PM
    BOOTSECT.BAK "created on" 2009/02/17 11:59 PM
    
    C:\>echo config.sys "created on" 2006/09/18 11:43 PM
    config.sys "created on" 2006/09/18 11:43 PM
    

    I think a more likely scenario would involve using windows scripting host, or powershell, but you did not mention that those are options for you, so I am assuming that there is a good reason, for not being able to use those technologies.

提交回复
热议问题