What is the best command to move all files from one folder to another?
I want to do this from within a batch file.
This question is related to
batch-file
cmd
command-prompt
This command will move all the files in originalfolder to destinationfolder.
MOVE c:\originalfolder\* c:\destinationfolder
(However it wont move any sub-folders to the new location.)
To lookup the instructions for the MOVE command type this in a windows command prompt:
MOVE /?
Be sure to use quotes if there are spaces in the file path:
move "C:\Users\MyName\My Old Folder\*" "C:\Users\MyName\My New Folder"
That will move the contents of C:\Users\MyName\My Old Folder\
to C:\Users\MyName\My New Folder
robocopy seems to be the most versatile. See it's other options in the help
robocopy /?
robocopy SRC DST /E /MOV
move c:\sourcefolder c:\targetfolder
will work, but you will end up with a structure like this:
c:\targetfolder\sourcefolder\[all the subfolders & files]
If you want to move just the contents of one folder to another, then this should do it:
SET src_folder=c:\srcfold
SET tar_folder=c:\tarfold
for /f %%a IN ('dir "%src_folder%" /b') do move "%src_folder%\%%a" "%tar_folder%\"
pause
OMG I Got A Quick File Move Command form CMD
1)Command will move All Files and Sub Folders into another location in 1 second .
check command
C:\user>move "your source path " "your destination path"
Hint : For move all Files and Sub folders
C:\user>move "f:\wamp\www" "f:\wapm_3.2\www\old Projects"
you can see that it's before i try some other code that was not working due to more than 1 files and folder was there. when i try to execute code that is under line by red color then all folder move in 1 second.
now check this image. here Total 6.7GB data moved in 1 second... you can check date of post and move as well as Folder name.
i will soon make a windows app that will do same..
use move
then move <file or folder> <destination directory>
Lookup move /?
on Windows and man mv
on Unix systems
Source: Stackoverflow.com