Change data source for multiple layers in ArcMap document?
Instructions provided in Use the 'Set Data Source' tool for map documents in ArcCatalog describe how to use the Set Data Source tool for map documents in ArcCatalog.
When right-clicking a map document (.mxd) file in ArcCatalog, a Set Data Source command is visible. This opens a dialog box that makes it easier to update or repair some or all of the references to file-based data sources in the map. By default, this dialog box creates a copy of the .mxd file. This option is also available by right-clicking a published map (.pmf) file, although it is disabled if the publisher of the .pmf file selected not to provide full access to its contents in ArcGIS applications when it was published.
The Set Data Source tool cannot be used to update or repair references to data in ArcSDE geodatabases.
The Set Data Source tool does not support VBA customizations. Any VBA customizations are not included in the output MXD.
The Set Data Source tool does not support personal geodatabase annotation layers at this time. This is a known limit and is scheduled to be fixed in a future release of the software.
Procedure Follow these steps to set the data source for an MXD in ArcCatalog.
- Right-click an MXD in ArcCatalog and click Set Data Source(s). The default creates a copy of the MXD. It is recommended that a copy be used and the original MXD be kept as a back-up. However, the existing MXD can be overwritten by selecting it or typing its full path.
Select a data frame or all data frames.Select a layer or press the Select All button.
Click Replace or Replace All. The Replace dialog box does a 'find and replace' on the paths to the data. Type the 'find and replace' text to match the data. For example, if all the data was in C:\GISData but it has been moved to C:\GISData2, the Find What text box shows C:\GISData and the Replace With text box shows C:\GISData2. Click Replace. Click OK in the Set Data Sources dialog box.
There is also a MXD Data Source Replacer script in the UCLA Sandbox.
I have used the "Repair Data Source" tool. Right click on the layer, select "Data", then "Repair Data Source." Select the new location. This will update all layers in the MXD that have moved from one location to the same new location.
In ArcMap you can go to File->Map Document Properties ...., and in "Pathnames" check "Store relative pathnames to data sources". As long as your MXD is in the "main" folder, all the data in the same or chid folder will be find even in other machines, without having to replace the data source. The only thing you need to do is preserving the folder tree from the MXD to the children folders where your data are stored.