How to convert symlink to regular file?

There is no single command to convert a symlink to a regular file. The most direct way is to use readlink to find the file a symlink points to, and then copy that file over the symlink:

cp --remove-destination `readlink bar.pdf` bar.pdf

Of course, if bar.pdf is, in fact, a regular file to begin with, then this will clobber the file. Some sanity checking would therefore be advisable.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)