Avatar of IT CAMPER
IT CAMPER
Flag for United States of America asked on

Script to copy then rename file

Need script to copy a file to UNC destination then rename it. File pattern is T+A_AZNM_Fri_V71_DDF060821A.ZIP, where the day of the week changes each day (Mon, Tue, Wed, Thu, Fri, Sat, Sun). I need the script to locate the correct file for the day of the week, copy it, then rename to T+A_AZNM_MMDDYY_V71_DDF060821A.ZIP. Important to copy it first so that the original remains unchanged. 

Powershell

Avatar of undefined
Last Comment
Qlemo

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Qlemo

If you want to copy the file for the current day, all you need to do is
copy-item "T+A_AZNM_$(get-date -format 'ddd')_V71_DDF060821A.ZIP"  "T+A_AZNM_$(get-date -format 'MMddyy')_V71_DDF060821A.ZIP"

Open in new window

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck