Power shell How to delete old Archive folders (name as 2017-12,2018-1,2018-2,2017-10) older than 6 months RRS feed

  • Question

  • I have list of source folders like below which contains number of old folders( form last 1 year approximate)




    i developed a script which segregate files to folders and archive them.For example all March 2018 files will be in SrcA,SrcB,SrcC folders.

    Remaining files will be moved to folders and archived

    2017-12 folder where Dec2017 files will be there

    2018-1 folder where Jan2018 files will be there

    2018-2 folder where Feb2018 files will be there

    All March 2017 files will go to 2017-3 and 2018 Jan files will move to 2018-1 folders and archived.

    Now i need to add another functionality such a way that  if the archive file is more than 6 months it should deleted.Per example all archived folders like (2017-3 to till 2017-9) needs to deleted.

    But i'm unable to achieve this.Please help me.

    Thursday, March 29, 2018 12:03 PM