Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
xcopy "C:\Documents and Settings\Owner\My Documents\*.mp3" "C:\Documents and Settings\Owner\My Music" /s /c
An undefined problem has an infinite number of solutions.由obert A. Humphrey
@echo offfor /f "tokens=* delims=" %%i in ('dir "C:\Documents and Settings\Owner\My Document\*.mp3" /s') do ( copy "%%i" "C:\Documents and Settings\Owner\My Music" )
@echo offfor /f "tokens=* delims=" %%i in ('dir "C:\Documents and Settings\%Username%\My Document\*.mp3" /s') do ( copy "%%i" "C:\Documents and Settings\%Username%\My Music" )
Not too sure what I might've done wrong, but that did absolutely nothing for me...
The system cannot find the file specified.The system cannot find the file specified. Directory of C:\Documents and Settings\Owner.Murgatroyd7\Desktop\test\Angelo SpencerThe filename, directory name, or volume label syntax is incorrect. 0 file(s) copied.The system cannot find the file specified.The system cannot find the file specified.The system cannot find the file specified." Total Files Listed:" is not a recognized device. Total Files Listed:The filename, directory name, or volume label syntax is incorrect. 0 file(s) copied.The system cannot find the file specified.The system cannot find the file specified.
@echo offfor /f "tokens=* delims=" %%i in ('dir "C:\Documents and Settings\Owner.Murgatroyd7\Desktop\test\*.mp3" /s') do ( copy "%%i" "C:\Documents and Settings\Owner.Murgatroyd7\Desktop\curious\" )
xcopy "C:\Documents and Settings\Owner.Murgatroyd7\Desktop\test\*.mp3" "C:\Documents and Settings\Owner.Murgatroyd7\Desktop\curious" /s /c
@echo offfor /f "tokens=* delims=" %%i in ('dir "C:\Documents and Settings\Owner.Murgatroyd7\Desktop\test\*.mp3" /b /s') do ( copy "%%i" "C:\Documents and Settings\Owner.Murgatroyd7\Desktop\curious\" )
But what I'm wondering is...when using Sidewinder's code, how can I prevent overwriting? I'm not too worried about it with xcopy, but it's a problem with his code....
Better yet, how could it be set up to automatically rename like-named files (California(1).mp3, California(2).mp3, etc.)?
@echo offsetlocalset Source=C:\Documents and Settings\Owner.Murgatroyd7\Desktop\testset Dest=C:\Documents and Settings\Owner.Murgatroyd7\Desktop\curiousfor /f "delims=" %%a in ('dir "%Source%\*.mp3" /b /s') do ( if exist "%Dest%\%%~na%%~xa" ( call :IncrementFile "%%a" ) else copy "%%a" "%Dest%" )goto :EOF:IncrementFilefor /l %%b in (1,1,99) do ( if not exist "%Dest%\%~n1(%%b)%~x1" ( copy %1 "%Dest%\%~n1(%%b)%~x1" exit /b ) )
if not exist "%Dest%\%~n1(%%b)%~x1" ( copy %1 "%Dest%\%~n1(%%b)%~x1"
And thanks for the links, Willy.
I'm going to read up on those when I have some free time tonight.