Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving Files from Command line

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?

like image 810
Villumanati Avatar asked Mar 01 '12 13:03

Villumanati


2 Answers

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
like image 167
Ould Abba Avatar answered Oct 21 '22 05:10

Ould Abba


You want some thing like this.Eg.
move c:\windows\temp\*.* c:\temp

like image 38
4b0 Avatar answered Oct 21 '22 03:10

4b0