|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Deleting directory of more than 30 days I am looking for a DOS command to delete the subdirectory of a directory XX A with a creation date greater than 30 days from the date of the day. For a project of video monitoring, which records can not exceed 30 days of storage. Note: Be indulgent please because I've never done programming. thank you for your responses. |
#2
| |||
| |||
Re: Deleting directory of more than 30 days Hello, Dos it not so much flexible instead you can vbscript to do it.here i have this code .I confirm there is no DOS command unit that makes the job. Batch is a real gas plant. Is better to move to another language (vbscript to test but something about it should work): |
#3
| |||
| |||
Re: Deleting directory of more than 30 days Hi modifier is right here the code for your requirement in vb script hope this will help you Code: Select All Dim objFso, objFolder, objSubFolder Dim strPath Dim diffDate Dim arrSubFolder() Dim i strPath = "c:\tmp\toto" nbDays = 30 Set objFso = CreateObject("Scripting.FileSystemObject") Set objFolder = objFso.GetFolder(strPath) Set objSubFolder = objFolder.SubFolders For Each folder in objSubFolder diffDate = DateDiff("d",folder.DateCreated,Now) if diffDate > nbDays then ReDim preserve arrSubFolder(i) arrSubFolder(i) = folder.Name i = i + 1 end if Next For Each folder in arrSubFolder objFSO.DeleteFolder(strPath & "\" & folder) Next set objFso = nothing set objFolder = nothing set objSubFolder = nothing |
#4
| |||
| |||
Re: Deleting directory of more than 30 days Quote:
In theory they will contain only files (recordings). Thank you for the code, I will show it to my colleague. And it will test. Ah I did not specify. It should also be removed empty directories . |
![]() |
|
Tags: days, deleting, directory |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calendar days vs work days | Boerseun | Microsoft Project | 4 | 02-07-2014 10:28 PM |
Converting work days to calendar days | TheTurner | Microsoft Project | 12 | 02-07-2014 10:15 PM |
Script for deleting folders + content in root of D:\ after # days | lca1630 | Windows Server Help | 6 | 28-03-2012 08:50 PM |
Changing Calendar to count all days and not only BUSINESS days | M Moreno | Microsoft Project | 3 | 12-01-2011 05:05 AM |
find period in days / hours excluding weekdays between two days? | Segvoia | Software Development | 3 | 19-06-2009 11:17 AM |