BAT to copy files over, rename old folder, and make link to new folder in old folder's name.

Note
1. Group Policy must allow user to create symlinks inwindows 10 and
2. Move the RenameAndMkLink.bat to the TARGET folder location - then drag and drop the FROM folder of the RenameAndMkLink.bat file in its new location.

for special files like Documents folderd use Windows 10 to relocate.

@echo off @Echo NOTE: SymLinks must be enabled for user to work via GPO. @echo Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment rem @echo 001 set SourcePath=%~1 IF NOT EXIST %SourcePath%\NUL goto NOTWINDIR rem @echo 001a set DestDrive= %~d0 rem echo 001b for /f "delims=" %%a in ("%~1") do ( set SourceFolder=%%~nxa ) set SourceFolder=%SourceFolder: =% @echo %sourcefolder% rem pause rem echo 001c set DestPath=%~dp0%SourceFolder% set DestPath=%DestPath: =% rem @echo 002 for /f "tokens=1* delims=" %%a in ('date /T') do set SourceDate=%%a @echo SourceDate=%SourceDate% set SourceDate=%SourceDate: =% rem @echo 003 @echo SourcePath= %SourcePath% @echo DestPath= %DestPath% @echo DestDrive= %DestDrive% @echo SourceFolder= %SourceFolder% @echo 004 rem pause robocopy "%SourcePath%" "%DestPath%" *.* /E /DCOPY:T /XO /XJ /XJD /XJF /xx @echo ren "%SourcePath%" "%SourceFolder%_%SourceDate%" mklink /d "%SourcePath%" "%DestPath%" goto ExitBat :NOTWINDIR @echo "Must drag and drop a folder for this to work." :ExitBAT pause

for special files like Documents folder use Windows 10 to relocate:

Click the [Windows] button > choose "File Explorer."
From the left side panel, right-click "Documents" > choose "Properties."
Under the "Location" tab > type "H:\Docs"

Click [Apply] > Click [No] when prompted to automatically move all files to the new location > Click [OK].


Comments

Popular posts from this blog

Powerpoint countdown and current time in slides VBA

Revit area plans adding new types and references (Gross and rentable)