-1

This SO answer shows how to copy a directory recursively and expand all the symlinks from the command line using bash. I cannot find the same functionality in Swift. Does such a function exist? How do I do this concisely in Swift? I could call this bash command from Swift, but would prefer a pure Swift solution.

FileManager.copyItem copies the symbolic links without resolving them.

This SO answer shows how to resolve a single symlink. However, I would prefer not to traverse the directory manually, checking if each item is symlink that needs to be resolved.

bjschoenfeld
  • 402
  • 6
  • 14
  • 1
    Use this [FileManager function](https://developer.apple.com/documentation/foundation/filemanager/2765464-enumerator) to enumerate a directory structure and then copy the relevant URL’s. – Joakim Danielson Nov 19 '21 at 18:45

1 Answers1

0

To the best of my knowledge you need to write file manager code that traverses the directory structure manually.

Duncan C
  • 128,072
  • 22
  • 173
  • 272