Is it possible to change the directory of a layer's source file without deleting and re-importing the layer?

  • Are you after any method (GUI/programmatically), and any version of QGIS?
    – nmtoken
    Jun 18, 2019 at 10:09
  • Preferably GUI and latest version. I'll try romainbh's answer next time the issue presents itself. Jun 18, 2019 at 12:32

1 Answer 1


Yes, with the plugin Change datasource, it's the easiest way to change the path of a layer in QGIS.

Copy the layer file (or multiples files in the case of a shapefile) into the new directory and then open your project and change the source with the plugin.

  • Perfect, thank you! Jun 20, 2019 at 10:48
  • The plugin is a bit opaque to me. It asks for a string to be replaced with another string, but that does not seem to work. Any suggestions? Do I need to really use this in QGIS.3.22? The Bad Layers handler launches in the beginning but does not seem to work for me, hence I went to this plugin...
    – Sharad
    Feb 27 at 11:19
  • UPDATE: I figured out that if I ignore QGIS' native "Handle Missing Layers" dialogue (click "Keep unavailable layers") and then go and 'fix' one of the layers that has a 'bad data source', the others also get fixed automatically. Rather counter-intuitive, but worked. (I did not use the plugin at all)
    – Sharad
    Feb 27 at 11:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.