Hello,
I have a large number of folders, each of which has a subfolder for archived content. The subfolders in each folder all have the same name, e.g. "Archives." In order to conserve hard drive space, I want to move all of the Archives subfolders to a different drive, keeping the full directory tree structure intact in the process (in order to identify each Archives subfolder, and avoid duplicate folder name issues).
Can anyone suggest a batch file solution to accomplish this?
Thank you,
RickB
Move multiple subdirectories all with same name
Moderator: DosItHelp
Re: Move multiple subdirectories all with same name
Not sure I understood your request correctly. So, I guess you want to create the parent folder of your "Archives" too, but only copy the "Archives".
Steffen
Code: Select all
@echo off &setlocal
set "src=C:\somewhere"
set "dst=D:\somewhere else"
set "find=Archive"
for /f "delims=" %%i in ('dir /ad /b /s "%src%\%find%"') do (
for %%j in ("%%~i\..") do (
robocopy "%%~i" "%dst%\%%~nxj\%%~nxi" /e /r:0 /w:0
)
)
pause
Re: Move multiple subdirectories all with same name
Code: Select all
xcopy /e /i /q /-y path/targetfile.xxx %destination/path%
Re: Move multiple subdirectories all with same name
Beside of the fact that xcopy is rather deprecated, how does it solve the problem of having always the same folder name "Archive!?
Steffen
Steffen
Re: Move multiple subdirectories all with same name
What is "foldername" for in your snippet? Again, read the initial post. The folders to be copied have the same name.
Steffen
Steffen