Avatar of williamfl
williamfl
 asked on

How to Robocopy a file to a variable folder name.

How to Robocopy  a file to a variable folder name.
I am current trying to manage files in a jboss war file (deploy\tmp543236qcbin-exp.war\) folder that changes its name on every start. It is a cached set of files.
One task:
Manage an image. Want to replace image in cached folder. (deploy\tmp543236qcbin-exp.war\images)
Second task:
Replace an html file in the cache folder.
Did not see any parameters in robocopy to allow us to send file file to a wildcard folder.
Windows BatchScripting LanguagesMicrosoft Development

Avatar of undefined
Last Comment
oBdA

8/22/2022 - Mon
Hamed Nasr

You may set a variable for any part of the command and expand as %variable% in the proper place of the command.

Example:
Robocopy.exe  d:\ G:\f\ *.txt

Set sd=D
Set df = G:\f
Set files = *.txt

Robocopy.exe  %sd%:\ %df%\ %files%

Don't forget usual options for purge and exclude ..
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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes