Topic ""ln -s" command to selected files"

Author Message
Prooksius

Guest


Hello!

Is it possible to do such a command:
Select needed files in the current directory and create symlinks for them with names the same as file names and extension - the last symbol = '0'.

For instance:
I mark following files

kjdj.doc
kdlkf.txt

Then I launch the magic command and in current directory I will have more two files:

kjdj.do0
kdlkf.tx0

which are symlinks to the first two files.

Thank you in advance.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
The "magic" custom command would be:
Code:
ln -s '!' `echo '!' | sed 's/.$/0/'`

Make sure you use right quotes. There are back-quotes around the "echo '!' | sed 's/.$/0/'"

Probably there is much better/simpler way how to achive the same results, but I'm not an expert in unix shell.
_________________
Martin Prikryl
Prooksius

Guest


Thanks, but this command don't work with long file names with spaces.
Following command works fine:

ln -s '!' "`echo '!' | sed 's/.$/0/'`"

Just for somebody who needs this.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License