我正在使用以下内容,但它仅移动文件而不移动源文件夹中的文件夹。我可以添加任何内容吗?
move "C:\source\*" "C:\destination\"
@echo off
setlocal enableextensions disabledelayedexpansion
set "source=c:\source"
set "target=c:\destination"
(if not exist "%target%\" md "%target%" ) && (
pushd "%source%" && (
for /f "delims=" %%a in ('dir /a /b *') do move "%%a" "%target%\"
popd
)
)
Ensure that target folder exist, then, if source folder is accesible, change active directory to the source folder, and for each element inside it, execute a move operation to the target folder
This is another way: test it on sample folders first.
robocopy "C:\source" "C:\destination" /move /s
EDIT: Robocopy copies the files and then deletes the original, so will take a long time for large files, even if the source and target locations are on the same hard drive.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.