. . . for example if I want all .doc to be copied from C Drive it copies all, the thing is I need it to copy 20, or 10 files not full .doc from C drive.
C:\batch>type akki.bat
@echo off
setLocal EnableDelayedExpansion
set /a c=0
set destfolder=E:\copydoc\
for /f "delims==" %%i in ('dir c:\*.doc /s /b') do (
echo %%~nxi
set /a c+=1
echo c=!c!
if !c! GTR 9 goto end
copy "%%i" %destfolder%
)
:end
Output:C:\batch>akki.bat
longshot.doc
c=1
1 file(s) copied.
longshot.doc
c=2
1 file(s) copied.
ls.doc
c=3
1 file(s) copied.
winword.doc
c=4
1 file(s) copied.
winword2.doc
c=5
1 file(s) copied.
fractions.doc
c=6
1 file(s) copied.
third.doc
c=7
1 file(s) copied.
twothird.doc
c=8
1 file(s) copied.
What is My IP Address.doc
c=9
1 file(s) copied.
aarp081009.doc
c=10
C:\batch>
E:\copydoc>dir
Directory of E:\copydoc
03/12/2010 06:18 PM <DIR> .
03/12/2010 06:18 PM <DIR> ..
10/23/2009 09:25 PM 20,480 fractions.doc
03/06/2005 09:59 PM 4,195 longshot.doc
03/06/2005 09:59 PM 4,195 ls.doc
10/23/2009 08:44 PM 24,576 third.doc
10/23/2009 08:45 PM 24,576 twothird.doc
10/20/2009 11:27 AM 24,064 What is My IP Address.doc
04/14/2008 06:00 AM 4,608 winword.doc
04/14/2008 06:00 AM 1,769 winword2.doc
8 File(s) 108,463 bytes
2 Dir(s) 139,440,300,032 bytes free
E:\copydoc>