1

I need to cut some first characters from file name in current mc panel and create hard link in pasive mc panel with this name. Example:

ls 001-a\ b.flac | cut -c 5- | xargs -0 -I{} echo ln %p %D/{}

I get expectet result:

ln 001-a b.flac /srv/Music/a b.flac

But, without echo:

ls 001-a\ b.flac | cut -c 5- | xargs -0 -I{} ln %p %D/{}

I get result:

ln 001-a b.flac /srv/Music/a b.flac.

With DOT at the end of file name in pasive panel

I've found similar question how to remove final “dot” from directory name. But how can I avoid this DOT at the end of file name in mc extension command?

PS
problem xpression in mc extension file:

regex/i/\.flac
Open=ls %p | cut -c 5- | xargs -0 -I{} ln %p %D/{}

ADDED SOLUTION ?

how make playlists with hard links and refactory names of songs in it I found in "How can i pass all arguments with xargs in middle of command in linux"

ln %p %D/"`ls %p | cut -c 5- `"

It works in mc envirounment only

Community
  • 1
  • 1
user1855805
  • 137
  • 1
  • 1
  • 9

2 Answers2

0

Have you considered using find/sed to modify the name?

find . -name "001-a b.flac" -maxdepth 0 -print0 | sed 's/001-//g' | xargs -0 -I{} ln %p %D/{}

Then you could of course make sed more generic:

sed 's/[[:digit:]]\+-//g'

I'm not sure what "mc" is, so my answer is probably not exactly what you need. Good luck.

Paul J
  • 1,489
  • 1
  • 17
  • 19
0

how make playlists with hard links and refactory names of songs in it I found in "How can i pass all arguments with xargs in middle of command in linux"

ln %p %D/"`ls %p | cut -c 5- `"

It works in mc envirounment only

user1855805

Community
  • 1
  • 1
Armali
  • 18,255
  • 14
  • 57
  • 171