Page 1 of 1

copy a file using wildcard on source file

Posted: 03 Jan 2012 08:49
by parabolam
hello all.

i am looking for help with writing a batch file to copy a xls file from sharepoint.
the name of the xls file changes every day - it updates with a date every day.. but the first 2 words of the file always remain constant.
is it possible to copy this file but use wildcards after the first two words?

for example the file is named... Front Door 2012 Jan 03
tomorrow it will be Front Door 2012 Jan 04 and so forth...

is it possible to write a batch file to copy the file just using Front Door (and then use wildcards?)

thanks.

Re: copy a file using wildcard on source file

Posted: 27 Nov 2013 09:52
by rodrigolima
Hello parabolam

Try this script below:

Code: Select all

@echo off
cls

if exist pipeline.txt del pipeline.txt

:: Generate file path to wildcard by "Front Door"*
dir /b /s "Front Door"* > pipeline.txt

:: Get File Path from pipeline.txt
set /p file=<pipeline.txt

echo %file%
pause

copy "%file%" "C:\Front Door" /Y

if exist pipeline.txt del pipeline.txt

goto:eof


I Hope that it help you.

See you