HOW TO KNOW IF SOME FAILS ARE INTO SPECIFIC FOLDER

Welcome Forums General PowerShell Q&A HOW TO KNOW IF SOME FAILS ARE INTO SPECIFIC FOLDER

Viewing 1 reply thread
  • Author
    Posts
    • #176719
      Participant
      Topics: 4
      Replies: 5
      Points: 57
      Rank: Member

      Good morning All,

      I am a beginner in PowerShell, and I would like to ask you the following:

      I copy a bunch of files (.zip) into a specific INCOMING folder, then they are converted to .7z files and then they are moved to an ARCHIVE folder (.7z), if all the process was OK, then the files are moved to another folder (IMPORTED), But, if some of the files for some reason fail, then they are moved to a FAILED folder.
      My question is I need to know how many of them went to the IMPORTED folder and/or how many of them went to the FAILED folder and how many of them are in the ARCHIVE folder.
      Many thanks in advance.

    • #176725
      Participant
      Topics: 1
      Replies: 1635
      Points: 3,089
      Helping Hand
      Rank: Community Hero

      Could you please show the code you arleady wrote? Thanks

      Actually you just need to do a Get-ChildItem for each of your desired folders and count the files you get.

      • #176872
        Participant
        Topics: 4
        Replies: 5
        Points: 57
        Rank: Member

        Hi Olaf, Many thanks for your reply.

        The code is:

        $Failed = "D:\LPStorage\Fail\*"
        $Archive = "D:\LPStorage\Archive\*"
        (Get-ChildItem -include *.zip -Path $Failed).Count
        (Get-ChildItem -include *.7z -Path $Archive).Count

        Many thans again.

         

Viewing 1 reply thread
  • You must be logged in to reply to this topic.