HOW TO KNOW IF SOME FAILS ARE INTO SPECIFIC FOLDER

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.

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.

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.