Question: What is the most direct way to convert a symlink into a regular file (i.e. a copy of the symlink target)?

Suppose `filename` is a symlink to `target`. The obvious procedure to turn it into a copy is:

```
cp filename filename-backup
rm filename
mv filename-backup filename

```

Is there a more direct way (i.e. a single command)?

Answer: 
Many have already stated the following solution: 

```
cp --remove-destination `readlink file` file

```

However, this will not work on symbolically linked directories. 

Adding a **recursive** and **force** will not work either: 

```
cp -rf --remove-destination `readlink file` file

```

**cp: cannot copy a directory, ‘path/file, into itself, ‘file’** 

Therefore, it is probably safer to delete the symlink entirely first: 

```
resolve-symbolic-link() {
  if [ -L $1 ]; then
      temp="$(readlink "$1")";
      rm -rf "$1";
      cp -rf "$temp" "$1";
  fi
}

```

Not exactly a one-liner like you had hoped, but put this it into your shell environment, and it can be.
This worked perfectly for me (**edited to work with spaces**):

```
find . -type l | while read f; do /bin/cp -rf --remove-destination -f $(find . -name $(readlink "${f}")) "${f}";done;

```

Allows you to recursively convert all symlinks under the current working folder to its regular file. Also doesn't ask you to overwrite. the "/bin/cp" exists so that you can bypass a possible cp -i alias on your OS which prevents the "-rf" from working.