Have you ever wanted to copy a directory tree of family files to a single directory? Once you do this, you can load them all into a Revit instance in a single “Load Family” operation – just go to the directory and then Ctrl+A to select all, then click Open.
The following script will copy a directory tree to a single directory – essentially discarding the directory structure. It also filters by file type and only includes RFA files. Copy the code to Notepad, save as CMD or BAT.
dir “sourcedirectory” /A:D /B /S > tempListOfDirs.txt
For /F “tokens=*” %%A IN (tempListOfDirs.txt) Do (
If Exist %%A* (
XCOPY “%%A*.rfa” “targetdirectory” /Y /R
Once you have a single directory of RFA files and have loaded them all into Revit, you could then use the categorizer to sort them all into directories by Category… its really an automated and free way to upgrade and sort your family library.
Note: I had previously posted a similar script using Robocopy at
What Revit Wants: Copy a Directory Tree “Flat” – all files into one folder, no subfolders
This code modified from:
Commerce Server Guy: Tree-To-Flat Copy Using XCopy
Let’s say you have exported all families in a Revit project to a bunch of folders by Category, but you want to get them all into one folder so you can drag-drop and load them all into a new project all at once…
Copy the following into a batch file:
::Not sure if this is needed
::It guarantees you have a canonical path (standard form)
for %%F in (%destination%) do set destination=”%%~fF”
for /r %source% %%F in (.) do if “%%~fF” neq %destination% ROBOCOPY “%%F” %destination% *.rfa /COPYALL /R:0
Now, change the text in red to suit your source and destination (my destination folder was empty). Run the batch file and you should have a stack of RFAs all sitting in that folder. Note: results may be a bit unpredictable if you have duplicates of particular files in the source directory tree.
file – ROBOCOPY – Copy folders content to a single folder – Stack Overflow
This technique allows file operations and programs to be initiated from an in-canvas Revit modelling session, without the need to switch to Windows Explorer.
Basically, you just need a Symbol family with URL instance parameter. In the URL parameter, paste a fully resolved path to the script or exe file (you can use Shift + rightclick to quickly get this from Explrorer in Windows 7). Now, when you select the Symbol family, click on the dots in the Properties Palette – the exe or script will run, directly from Revit
- Launch any program
- Launch a program that may be useful in-canvas (like Colorette)
- Launch a search program like Locate32, that can be used to search for Revit content and drag-drop into the Revit session
- Copy point clouds to local drive
- Map network drives
- Archive RVT folder script, perhaps using 7-zip
- Run Autodesk program update packages (some of these may require Revit to be shutdown)
- Run add-in installers (that will probably require Revit to be updated)
- Copy macro updates
- Delete Revit backup files script
- Clean up Journal folder
- Make a backup of Keynote file or Shared Parameter file (perhaps used before editing)
- Run Windows Task Scheduler tasks
- Shutdown the computer
Once you have the Annotation family loaded and placed, just add the suitable path, and then select the element and click where the little dots should be:
The command is instantly triggered.
In a worksharing environment, you could set up a Drafting View where you placed different instances of this “linker” family to trigger various project-related scripts.
This idea grew from this post and this one about copying Point Clouds.
Typically, large point clouds are stored on local hard drives. Revit allows for this with the Options – “Root path for point clouds” setting.
Here is an easy way to copy them:
. (Should be located in C:WindowsSystem32)
Make a BAT file that looks something like this:
robocopy C:ProjectsPointClouds OTHER_PC_NAMEPointClouds(shared folder) *.RCS *.RCP /MIR /COPY:DAT /DCOPY:T /ZB /LOG:C:TEMPlogfile.log /R:2 /xn
This script was used to copy only RCP and RCS files from my local hd to a shared drive on another users PC, so that we could both work with large point cloud files without clogging up the server with like 50gb of point data. Keep in mind you need to put these files in the same place relative to your Revit Options – Root Path for Point Clouds.
Additionally, if you have not previously been using the root folder for all your point clouds, you may have to re-link them to create the appropriate path associativity.