File finder help
Posted: 05 Jan 2010 00:13
I just need a little more help with this one. I need to replace all of the -------- with code that will search the computer for the files then copy them to the usb drive. Any help would be greatly appreciated.
here is the code.
Start
:back
@echo off
:start
cls
echo 1 Locate all docx files
echo 2 Locate all jpg files
echo 3 Locate all pptx files
echo 4 Locate all xlsx files
echo 5 Locate all txt files
echo 6 Exit
set /p userinp=choose a number(1-6):
set userinp=%userinp:~0,1%
if "%userinp%"=="1" goto 1
if "%userinp%"=="2" goto 2
if "%userinp%"=="3" goto 3
if "%userinp%"=="4" goto 4
if "%userinp%"=="5" goto 5
if "%userinp%"=="6" goto 6
echo invalid choice
goto start
:1
cls
@echo off
echo a docx
echo b doc
echo c back
set /p userinp=choose an option(a,b,c)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto docx1
if "%userinp%"=="b" goto doc2
if "%userinp%"=="c" goto back
:docx1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copydocx
if "%userinp%"=="b" goto 1
:doc2
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copydoc
if "%userinp%"=="b" goto 1
goto end
:copydocx
-----------
:copydoc
-----------
:2
cls
@echo off
echo a docx
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto jpg
if "%userinp%"=="b" goto back
:jpg
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyjpg
if "%userinp%"=="b" goto 2
goto end
:copyjpg
-----------
:3
cls
@echo off
echo a pptx
echo b ppt
echo c back
set /p userinp=choose an option(a,b,c)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto pptx1
if "%userinp%"=="b" goto ppt2
if "%userinp%"=="c" goto back
:pptx1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copypptx
if "%userinp%"=="b" goto 3
:copypptx
----------
:ppt2
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyppt
if "%userinp%"=="b" goto 3
:copyppt
------------
goto end
:4
cls
@echo off
echo a xlsx
echo b xls
echo c back
set /p userinp=choose an option(a,b,c)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto xlsx1
if "%userinp%"=="b" goto xls2
if "%userinp%"=="c" goto back
lsx1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyxlsx
if "%userinp%"=="b" goto 4
:copyxlsx
-------------
ls2
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyxls
if "%userinp%"=="b" goto 4
:copyxls
--------------
goto end
:5
cls
@echo off
echo a txt
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto txt1
if "%userinp%"=="b" goto back
:txt1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copytxt
if "%userinp%"=="b" goto 5
:copytxt
--------------
goto end
:6
cls
exit
stuff
goto end
:end
pause>nul
End of Code
here is the code.
Start
:back
@echo off
:start
cls
echo 1 Locate all docx files
echo 2 Locate all jpg files
echo 3 Locate all pptx files
echo 4 Locate all xlsx files
echo 5 Locate all txt files
echo 6 Exit
set /p userinp=choose a number(1-6):
set userinp=%userinp:~0,1%
if "%userinp%"=="1" goto 1
if "%userinp%"=="2" goto 2
if "%userinp%"=="3" goto 3
if "%userinp%"=="4" goto 4
if "%userinp%"=="5" goto 5
if "%userinp%"=="6" goto 6
echo invalid choice
goto start
:1
cls
@echo off
echo a docx
echo b doc
echo c back
set /p userinp=choose an option(a,b,c)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto docx1
if "%userinp%"=="b" goto doc2
if "%userinp%"=="c" goto back
:docx1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copydocx
if "%userinp%"=="b" goto 1
:doc2
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copydoc
if "%userinp%"=="b" goto 1
goto end
:copydocx
-----------
:copydoc
-----------
:2
cls
@echo off
echo a docx
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto jpg
if "%userinp%"=="b" goto back
:jpg
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyjpg
if "%userinp%"=="b" goto 2
goto end
:copyjpg
-----------
:3
cls
@echo off
echo a pptx
echo b ppt
echo c back
set /p userinp=choose an option(a,b,c)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto pptx1
if "%userinp%"=="b" goto ppt2
if "%userinp%"=="c" goto back
:pptx1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copypptx
if "%userinp%"=="b" goto 3
:copypptx
----------
:ppt2
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyppt
if "%userinp%"=="b" goto 3
:copyppt
------------
goto end
:4
cls
@echo off
echo a xlsx
echo b xls
echo c back
set /p userinp=choose an option(a,b,c)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto xlsx1
if "%userinp%"=="b" goto xls2
if "%userinp%"=="c" goto back
lsx1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyxlsx
if "%userinp%"=="b" goto 4
:copyxlsx
-------------
ls2
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copyxls
if "%userinp%"=="b" goto 4
:copyxls
--------------
goto end
:5
cls
@echo off
echo a txt
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto txt1
if "%userinp%"=="b" goto back
:txt1
cls
echo a copy to the usb drive
echo b back
set /p userinp=choose an option(a,b)
set userinp=%userinp:~0,1%
if "%userinp%"=="a" goto copytxt
if "%userinp%"=="b" goto 5
:copytxt
--------------
goto end
:6
cls
exit
stuff
goto end
:end
pause>nul
End of Code