Delete files older than 2 days dos




















Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related Hot Network Questions. Stack Overflow works best with JavaScript enabled. Accept all cookies Customize settings. James e. James k 39 39 gold badges silver badges bronze badges. And the only question I have: how to add multiple mask for example ".

Viktor Ka Viktor Ka 3 3 silver badges 5 5 bronze badges. This even works in Windows Server and above and Windows 7. First, the tables: Days since UTC for each year including leap days. Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year with days: 0 31 59 90 Year with days: 0 31 60 91 Converting a date to number of seconds since is quite easy using those tables. Attention please! The file can be deleted if seconds rem value is lower than the value calculated above.

Further the batch code below is optimized for 24 hours time format. Mofi Mofi Copy this code and save it as DelOldFiles. WriteLine f1 f1. Paris Paris 89 1 1 silver badge 1 1 bronze badge. Use forfiles. There are different versions. Early ones use unix style parameters. Aidan Ewen Aidan Ewen Kibbee it's not the same answer the syntax is different. This was a geniune attempt to help. Knowning very little of the windows command line, I spent hours of frustration getting this to work.

The key bits of info for me were the fact that there's different versions with different syntax , and that I needed to removed the spaces. Neither of these things were included in the orginal answer.

I would have commented on the answer but I don't have the privileges — Aidan Ewen. CreateObject "Scripting. SubFolders ; for ;! Graham Laight Graham Laight 4, 3 3 gold badges 28 28 silver badges 26 26 bronze badges. It can be done in less than 10 lines of coding! Sting Sting 2 2 silver badges 11 11 bronze badges. Io-oI 2, 3 3 gold badges 17 17 silver badges 25 25 bronze badges. Lectrode Lectrode 1 1 gold badge 2 2 silver badges 12 12 bronze badges.

Shawn Pauliszyn Shawn Pauliszyn 6 6 bronze badges. The existing second-most-upvoted answer also espouses RoboCopy. Granted, you use somewhat different options, but it is close to the existing answer.

This has post has a new content--moving files to the recycle bin. This has not yet been been proposed with Robocopy and it fully answers the original post using a built-in single-line command.

Hey I'm still new here--give me a break; — Shawn Pauliszyn. In other words - don't try to invent this, unless you really can't use the third party tools. Paulius Paulius 5, 7 7 gold badges 41 41 silver badges 47 47 bronze badges.

Goran B. Miguel Carrillo Miguel Carrillo 4 4 silver badges 6 6 bronze badges. Snickbrack Snickbrack 2 2 gold badges 14 14 silver badges 48 48 bronze badges. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Education Sector. Microsoft Localization. Microsoft PnP. Healthcare and Life Sciences. Internet of Things IoT. Enabling Remote Work. Small and Medium Business. Humans of IT. Green Tech. MVP Award Program. Video Hub Azure. Best Smartwatches. Best Gaming Laptops.

Best Smart Displays. Best Home Security Systems. Best External Solid State Drives. Best Portable Chargers. Best Phone Chargers.

Best Wi-Fi Range Extenders. Best Oculus Quest 2 Accessories. Best iPad Air Cases. Awesome PC Accessories. Best Linux Laptops. Best Wireless iPhone Earbuds. Best Bluetooth Trackers.



0コメント

  • 1000 / 1000