Question: Firstly I'm newbie so sorry if this is a simple task.
I have a folder which contains only PDF files and I need to copy only files which contain certain text [this text varies but the start is always the same]
for example

* test\_variablename\_datestamp.PDF.
* testing\_variablename\_datestamp.PDF.
* sample\_variablename\_datestamp.PDF.

I would like to copy any file which starts with test to a test folder, and so testing to testing folder and sample to sample folder.
I plan to have this as a script to run every 30 minutes so it only needs to copy if the file has changed [this should reduce the amount of copying it has to do] 

I'm new to batch scrip writing but I am trying it out today.

Thanks in advance
J

Answer: 
You can use `*` as a wild card to move the files you need.

```
@echo off
pushd "C:\pdf_files"
copy test_*.pdf "C:\test_files"
copy testing_*.pdf "C:\testing_files"
copy sample_*.pdf "C:\sample_files"
popd

```

Obviously, replace the paths with the ones you're using.
This should reduce unnecessary copies:

```
@echo off

rem -- set folder paths WITHOUT ending slash
set pdf_folder=c:\pdfs
set test_folder=c:\tests
set testing_folder=c:\tests
set sample_folder=c:\sample

pushd %pdf_folder%

 rem -- COPY the non-existing in target folder files
 echo n|copy /-y test_*.pdf %test_folder%\
 echo n|copy /-y test_*.pdf %testing_folder%\<n
 echo n|copy /-y sample_*.pdf %sample_folder%\<n

 rem -- UPDATE only modified files
 replace test_*.pdf %test_folder% /u
 replace testing_*.pdf %testing_folder% /u
 replace sample_*.pdf %sample_folder% /u

popd

```