I have a directory on a windows share with 15,000 files in it. What i want do is move 500 files to a new directory.
Is there a way to do this from the command line?
there is the code you need. saved it as a .bat file and run it:
echo off
SETLOCAL EnableDelayedExpansion
set movedFiles=0
for /R c:\sourceFolder\ %%G in (*) do (
echo moving... "%%G"
move /Y "%%G" c:\destinationFolder\
set /a movedFiles+="1"
if !movedFiles! EQU 500 GOTO endOfCopy rem if you moved 500 files
)
:endOfCopy
echo Done, %movedFiles% files Where copied successfully
pause
ENDLOCAL
You want some thing like this.Eg.move c:\windows\temp\*.* c:\temp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With