We have the following script that was written several years ago. The purpose of this script is to change the permissions of all .JPG files within a directory and then change the file attribute to "A" so that it doesn't need to process these JPG's again. However, because it's running on such a large amount of data, it takes over a week to run when all JPG's need to be processed. I need to find a faster way to accomplish this task, but need assistance as I'm not an expert at scripting. I thought converting this script to run in powershell would be ideal. Can anyone assist me with this by re-writing this script in powershell?
for /F "delims=*" %%F in ('xcopy /S /L "E:\DATA\*.jpg" \ ^| findstr /v File^(s^)') do (
xcacls "%%F" /P "Authenticated Users:R" "Domain\Administrator:F" "SYSTEM:F" "Photo Admins:F" /Y
attrib -a "%%F"