Revit 2021 reorganize folders





@ECHO off
rem =====================================================:::START BATCH FILE
REM DISSEMINATES REVIT OOTB DRAG AND DROPPED
REM FOLDER TO CLIENT-SPECIFIC NAMED FOLDERS
REM file-folder path for drag and drop
REM =====================================================
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REM ***NOTE TEMPLATES AND LIBRARY DOWNLOADS ARE SEPARATE FOR EACH GEOGRAPHY!!!!
REM !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
REM DESTINATION PATH and DEFAULTS========================
rem ::: set NewPath=L:\AUTODESK\REVIT   ::REM :::::::::::: NEWPATH
:: REM NO ":REM" After SET = *, IF or CLS!!!
set NewPath=C:\TEMP\rTEMP
set Version=2018
set Client=ktgy_
REM ::: if no source prompts will help find content
REM ::: ~ removes " s is for short source path to remove spaces and junk 1 is for 1st passed arg(file)
@ECHO ===============================================================
@ECHO Pre-specified folders *VIA Sendto or drag and drop:
@set source=%~s1
IF [%source%]==[] GOTO MSGDragAndDropempty
@echo Source = "%source%"
goto MSGDragAndDropEnd
:MSGDragAndDropempty    : REM ::::::::::::::::::::::::::: If drag and drop empty 
@echo NONE
:MSGDragAndDropEnd      : REM ::::::::::::::::::::::::::: If drag and drop NOT empty
@ECHO ===============================================================
call :GetPrefixData
REM for ROBOCOPY PREFS **DO NOT** SPECIFY FILE *.*, that varies from call to call!
set RoboPrefs= /NJH /NFL /NDL /NC /Z /DCOPY:T /MT:4 /XO /IT /XJ /FFT /DST /XJD /XJF /R:0 /W:0 /REG /TBD /LOG+:%newpath%\RVT_%Version%_SPLIT.txt
rem ===set values=========================================
::REM :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: CLEAR SCREEN FOR NEXT BATCH
cls
::
@ECHO =USImperial TEMPLATES==========================================
REM SET ROOT DESTINATION
rem make sure no spaces after root file paths!~
set USImperial=%newpath%\%Client%I(US)-%Version%
REM --set COPY Project Templates & resolve short from path
IF "%version%" GEQ "2021" GOTO USIMP2021
    REM ELSE...
    GOTO USIMP_pre2021:
:USIMP2021                                           rem templates changes in 2020::2021 moved the files:::::::::
    set Src=%source%\Templates\English
    goto USIMP_SET
:USIMP_pre2021                                       rem PRE 2021 tempaltes still here...
    set Src=%source%\Templates\US Imperial
:USIMP_SET                                           REM ONCE VALUE SET CONTINUE
set Dest=%USImperial%\000-TEMPLATES-PROJECT

call :RoboCopySub

@ECHO =USImperial DICTIONARIES=======================================
REM --set COPY Dictionaries===========================
set Src=%source%
set Dest=%USImperial%\000-KEYS-CLASS-DIC
set Fopt=revitEN?.dic
call :RoboCopySub

@ECHO =USImperial USER DATA CACHE (dic FILES)========================
set Src=%source%\UserDataCache
set Dest=%USImperial%\000-KEYS-CLASS-DIC
call :RoboCopySub


@ECHO =USImperial FAMILY TEMPALTES====================================
:: C:\ProgramData\Autodesk\RVT 2018\Templates\US Imperial
REM --set COPY Project Templates & resolve short from path
IF "%version%" GEQ "2021" GOTO USIMP2021
    REM ELSE...
    GOTO USIMP_pre2021:
:USIMP2021                                           REM templates changes in 2020::2021 moved the files:::::::::
    set Src=%source%\Family Templates\English-Imperial
    goto USIMP_SET
:USIMP_pre2021                                       REM PRE 2021 tempaltes still here...
    set Src=%source%\Family Templates\English_I
:USIMP_SET                                           REM ONCE VALUE SET CONTINUE
set Dest=%USImperial%\000-TEMPLATES-FAMILY
call :RoboCopySub

@ECHO =IES FILES=====================================================
REM --set COPY IES For Metric & Imperial
set Src=%source%\ies
set Dest=%USImperial%\Lighting\000-IES
call :RoboCopySub

@ECHO =IMPERIAL CONTENT==============================================
REM --set COPY Imperial Library::::::::::::::::::::::::::::::::::::::
IF "%version%" GEQ "2021" GOTO USIMP2021
    REM ELSE...
    GOTO USIMP_pre2021:
:USIMP2021                                           REM templates changes in 2020::2021 moved the files:::::::::
    set Src=%source%\lIBRARIES\English-Imperial
    goto USIMP_SET
:USIMP_pre2021                                       REM PRE 2021 tempaltes still here...
    set Src=%source%\Libraries\US Imperial
:USIMP_SET                                           REM ONCE VALUE SET CONTINUE

set Dest=%USImperial%
call :RoboCopySub

MOVE /y %DEST%\*.TXT %DEST%\000-KEYS-CLASS-DIC\

@ECHO =CONDUIT TABLES=================================================
REM --set COPY CONDUIT TABLES - Metric & Imperial
set Src=%source%\Lookup Tables\Conduit
set Dest=%USImperial%\Conduit\000-Lookup_Conduit
set Fopt= /xf M_*.*
call :RoboCopySub

@ECHO =METRIC CONDUIT TABLES COMMONLY USED IN USA=====================
REM --set COPY Metric & Imperial======================
set Src=%source%\Lookup Tables\Pipe
set Dest=%USImperial%\PIPE\000-Lookup_Pipe
set Fopt= /xf M_*.*
call :RoboCopySub

@ECHO ================================================================
@ECHO ==FINISHED======================================================
@ECHO ================================================================
@ECHO = Run Renamer/Revit file folders cleanup =======================
@ECHO ================================================================
pause          
REM :::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::Pause  for screen end
exit /b       
GOTO :EOF
:END_OF ROUTINE :: REM :::::::::::::::::::::::::::::::::::::::::::::::: END OF MAIN ROUTINE

:RoboCopySub       :: REM ::::::::::::::::::::::::::::::::::::::::::::: EXEC ROBOCOPY WITH OPTIONS
REM CALL RESOLVE SHORT TO GET RID OF SPACES IN SOURCE PATH
call :ResolveShort_SRC
REM %SRC% has quotes stripped - EXIST requires Quotes to check folder
if NOT EXIST "%SRC%" (
@ECHO ================================================================
    @echo !!!NO SOURCE: "%SRC%" !!!!!!!!!!!!!!!!!!!
@ECHO ================================================================
    PAUSE
    REM ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: FORCE EXIT ROBOCOPY SUB ON NOPATH
    exit /b     
    )
@ECHO ================================================================
@ECHO SOURCE:::: %Src%
@ECHO DEST:::::: %Dest%
@ECHO Roboprefs: %Fopt% %RoboPrefs%
@IF not EXIST %dest% mkdir %dest%
@ECHO
robocopy "%Src%" "%dest%" /TEE %RoboPrefs% %Fopt%
@ECHO ================================================================
set Fopt= /e *.*
exit /b : REM EXIT /b = EXIT SUB
rem exit robocopy prefs :::::::::::::::::::::::::::::::::::::::::::::: END ROBOCOPY PREFS

:GetPrefixData      : REM :::::::::::::::::::::::::::::::GET PREFIX DATA
REM @ECHO =================================================
if not [%source%] == [] goto SkipSrcQuery : REM Skip if set            
:: Use to set Version text to match the MAJOR Version
:: of revit to look up the folder:
set /P Version=Please enter Revit Year or [enter] to use: %Version%
@ECHO Version  = %Version%
@ECHO.
::REM ::::::::::::::::::::::::::::::::::::::::::::::::::: Skip to exit on nothing specified
if [%Version%] == [] goto PrefixError  
::REM ::::::::::::::::::::::::::::::::::::::::::::::::::: Set SRC if not spec'd
if [%source%] == [] set source="C:\ProgramData\Autodesk\RVT %Version%"

REM Force SHORT path into SOURCE through evaluation of path - gets rid of spaces and quotes
REM TEMP assign SRC to %Source% as %Source% is reused.
set src=%source%
call :ResolveShort_SRC
set source=%src%
@ECHO Using SOURCE(short) = %source%
@ECHO.
::Must use quotes around source for path in folder issues. ::resolved by shortpath
IF EXIST %source% goto SkipSrcQuery:
    @echo GetPrefix 04-error "Does not exist"
    @echo EXITING
    PAUSE
exit
:SkipSrcQuery       : REM ::::::::::::::::::::::::::::::: For Skip if source spec'd VIA Drag and drop
GOTO BypassErr                                                : REM Bypass ERROR (Successful up till now)
:PrefixError               : REM :::::::::::::::::::::::::::::: Error out for above routine
@ECHO. Nothing entered- exiting!!
pause
exit :                REM error exit
:BypassErr            : REM :::::::::::::::::::::::::::::: BypassErr bypas Error handler
REM CLIENT PREFIX
REM CLEAR SCREEN :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::cls
@ECHO ================================================================
@ECHO.
set %Client%=ootb_
set /P Client=Please type a new Client_ prefix or [enter] for %Client% default:
IF "%Client%"=="" GOTO Error
GOTO End2
:Error
@ECHO. Nothing entered- exiting!!
exit : REM error exit
:End2
REM Validate before proceeding:::::::::::::::::::::::::::::::::::::::::::
CLS
@ECHO ================================================================
@ECHO.
set /P query=Enter Y to proceed with path %NewPath%\%Client%[varies]-%Version%:
@ECHO.
IF [%query%]==[Y] GOTO Proceed3
IF [%query%]==[y] GOTO Proceed3
:exit1
@ECHO ================================================================
@ECHO. "Y" or "y" not entered- Nothing done - Exiting.
:: REM error exit
exit
:Proceed3
:: End of sub
exit /b

:ResolveShort_SRC            : REM ::::::::::::::::::::::::::::Force resolve short path
::Force SHORT path into SOURCE through evaluation of path
set strBefore=%Src%
REM Strip Quotes
SET Src=%Src:"=%
REM Convert to short path
FOR %%i IN ("%Src%") DO (
    set Src=%%~si
    break
)
@echo Short path  %Src%   convert from   %strBefore% 
:: End of sub
exit /b




Comments

Popular posts from this blog

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

Powerpoint countdown and current time in slides VBA

Revit Python in Visual Studio Revit Stubs 2022 for Python Revit Intellisense