I need to move folders and their structure to somewhere else. I don't know the name of those folders. Move command is denied & copy doesn't keep structure in this state :
@echo on
for /D %%b in (*) do XCOPY "%%~fb" "C:\Users\*Username*\Desktop\New files" /Y /E
timeout /t -1
This is what I get :
sourcefolder destinationfolder
| Randomfolder1 | Randomfolder2
| | Randomfolder2 | \randomfile2.txt
| | \randomfile2.txt \randomfile1.txt
| \randomfile1.txt
\moverandomfolders.bat
Obviously I miss the name of the new folder in its new directory to keep the same structure. How do you add that random name to the new path ? I'd also need something to delete folders from their original path after they have been copied.
rd /s /q "*random folder name*"
I though making it with something like storing random folder names in vars but I made it simply work with an excludedfileslist, since I know them.
@echo on
for /D %%b in (*) do XCOPY "root folder" "destination folder" /Y /E /EXCLUDE:excludedfileslist.txt
for /D /R "root folder" %%X IN (*) DO RMDIR /S /Q "%%X"
timeout /t -1
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.