copy a file using wildcard on source file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
parabolam
Posts: 1
Joined: 03 Jan 2012 08:40

copy a file using wildcard on source file

#1 Post by parabolam » 03 Jan 2012 08:49

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.

rodrigolima
Posts: 21
Joined: 19 Jul 2013 11:35
Location: Brazil

Re: copy a file using wildcard on source file

#2 Post by rodrigolima » 27 Nov 2013 09:52

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

Post Reply