JadeKnight
IS-IT--Management
I'm creating av sub in a script wich is going to do the following :
Connect to a folder, list subfolders, delete all subfolders above i(integer) keeping the newest folder(s).
Ex :
C:\Folder
C:\Folder\A - 01.01.2005
C:\Folder\B - 01.02.2005
C:\Folder\C - 01.03.2005
C:\Folder\D - 01.04.2005
With a call to sub "KeepOnly("C:\Folder", 2)" the remaining folders should be :
C:\Folder\C - 01.03.2005
C:\Folder\D - 01.04.2005
I'm having trouble figuring out how to do this. When I loop the folder with fso.subfolders and use DateCreated, it seems like the sortorder is based upon folder name.
I had an ida to put a sorted result into an array, and delete folders based upon this.
Any help, or other good ideas would be appreciated
Connect to a folder, list subfolders, delete all subfolders above i(integer) keeping the newest folder(s).
Ex :
C:\Folder
C:\Folder\A - 01.01.2005
C:\Folder\B - 01.02.2005
C:\Folder\C - 01.03.2005
C:\Folder\D - 01.04.2005
With a call to sub "KeepOnly("C:\Folder", 2)" the remaining folders should be :
C:\Folder\C - 01.03.2005
C:\Folder\D - 01.04.2005
I'm having trouble figuring out how to do this. When I loop the folder with fso.subfolders and use DateCreated, it seems like the sortorder is based upon folder name.
I had an ida to put a sorted result into an array, and delete folders based upon this.
Any help, or other good ideas would be appreciated