LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-11-2005, 03:39 AM   #1
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438
Blog Entries: 5

Rep: Reputation: 32
midnight commander file rename ques


Over the past months I've been using MC alot, but despite reading the help files I haven't worked out the following thing.

When renaming a file and in dual directory view*, I press F6 to move/rename and the dialog box gives the lefthandside directory path by default.

Yep, that's great when you want to move files, but for simple renaming, it means having to type out the new name by hand. With so many files to rename, I'd prefer to be able to simple handedit the original name and have some typical edit key binding available (say the bash ones). i.e. I'd like the the original name to appear instead of the destination directory path, with the bash keybindings.

I've looked at the various mc config files and I can see this setting anywhere. Anybody understand the problem?

In fact, it's easier to do it in simple bash, but that lacks the visual panoramic view MC gives you.

Can anybody help?

* When writing that, it occurred to me that if I try another view in MC, it may just give me what I'm looking for. I'm going to try that now. And because I still haven't got cygwin working on my xp pro, I have to logout out totally for this and stick in a live cd. Will report back tho ...
 
Old 08-11-2005, 07:49 AM   #2
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
solved while writing LQ ques

Yes, I managed to get an instance of MC going, and my suspicion is true.

In MC, if you have the two directory view on , F6 will expect you to send the file to the other directory and will have the 2nd directory printed out in the dialog box waiting for you to simply type <return>, which makes it very easy, as long as you're moving files.

If, however, you change the view to info view, the F6 will assume you are renaming and stick in the original file name as I wanted. <ctrl>+a and <ctrl> works on this line.

So that's it! Cripes! that simple! The thought crossed my mind as I wrote it out and there you go, solved while writing. It appears to me that the act of writing out a question - carefully mind - in LQ sometimes leads you to self-solve it.

I wonder how many other people find that. It would be intersting to do a poll on the ways in which people finally have their linux questions solved.

I still ahev a whole load not solved .. including a locale one .. which I resusitated recently and it still ran into a cul-de-sac. Enfin, c'est la vie!
 
1 members found this post helpful.
Old 08-11-2005, 12:13 PM   #3
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
But you really need to get cygwin working on XP Pro.
 
Old 08-11-2005, 03:50 PM   #4
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
doggawn! drat!

who are you? How come, like, you *know*?

Back to those cygwin mailing lists ... sigh! "tell us when you find the solution to your that particular error report" etc etc.

:-D
 
Old 08-17-2005, 05:21 PM   #5
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
turns out that I´ve posted some superior spurious drivel about renaming in midnight commander.

That underlying logic doesn´t exist.

It's some sort of config setting, but it's going to take me a while longer to find out.

The"default destination field" when using F6 Ren/Move is what's at issue here but I can't seem to detect the setting for it in the mc.ext, mc.ini files. It might go by a different name.

At this stage I have to go to the sources to see how I can affect this F6 "default destination field". Now it starts to get complicated.

Renaming and moving seem to be totally synonomous in MC. In user terms, they aren't. Oh crap I can just see myself self spending hours on end trying to discover how to implement this tiny improvement.
 
Old 08-17-2005, 06:39 PM   #6
comprookie2000
Gentoo Developer
 
Registered: Feb 2004
Location: Fort Lauderdale FL.
Distribution: Gentoo
Posts: 3,291
Blog Entries: 5

Rep: Reputation: 58
F4 to edit F9 to pull down then save as, then F8 to deleate the first one if you want to.Thats how I do it may be a better way ...
 
Old 08-19-2005, 02:50 PM   #7
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
There is also the user menu: <F9> Command then select Edit menu file then select [Home]. At the top there is the user command that looks something like this:
Code:
+ t t
@       Do something on the tagged files
        set %t; CMD=%{Enter command}
        while [ -n "$1" ]; do
          $CMD "$1"
          shift
        done
So if you have a rename command which mose distros do just change the {Enter command} to {rename}. Now you can rename files by hitting <F2> then @. If you don't have rename then go to freshmeat and pick one you like.

<edit> Sorry don't change {Enter command} as that is only a prompt. You just need to enter the rename command and arguments in the popup text box when you hit <F2> then @. I must be tired.

Last edited by /bin/bash; 08-19-2005 at 03:29 PM.
 
Old 08-19-2005, 03:09 PM   #8
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
I would suggest the rename out of the slackware distro. You'll find it in the util-linux package

Just pull out the rename binary and put it in /usr/bin and pull out the rename.1.gz file and put it in /usr/man/man1.

Last edited by /bin/bash; 08-19-2005 at 03:10 PM.
 
Old 08-20-2005, 03:11 AM   #9
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Looking at my above posts, I'm not sure I made clear what I'm trying to say. Within mc you have the ability to input a command of your choosing by typing <F2> then @. The command will be executed against each file selected, one at a time. If you want to customize this you can edit the user menu which is located at ~/.mc/menu

Code:
+ t t
@       Do something on the tagged files
        set %t; CMD=%{Enter command}
        while [ -n "$1" ]; do
          $CMD "$1"
          shift
        done
For instance If you want to cut down on typing so you don't have to type in rename each time you can put the rename command before the $CMD and all you would have to do is input the parameters. e.g.

Code:
+ t t
@       Rename the tagged files
        set %t; CMD=%{Enter from to}
        while [ -n "$1" ]; do
          rename $CMD "$1"
          shift
        done
Now suppose you have a file listing like such:

$ ls -1

file1.txt
file10.txt
file2.txt
file3.txt
file4.txt
file5.txt
file6.txt
file7.txt
file8.txt
file9.txt

Arrgh! They're out of order. So in mc select file1.txt - file9.txt and do this:
<F2> @
In message box type this:
file file0 <- thats a zero:

Now if you list the directory they are all in order.

$ls -1

file01.txt
file02.txt
file03.txt
file04.txt
file05.txt
file06.txt
file07.txt
file08.txt
file09.txt
file10.txt
 
Old 10-24-2012, 02:52 PM   #10
EduPorteño
LQ Newbie
 
Registered: Oct 2012
Location: Argentina
Distribution: Ubuntu - Knoppix
Posts: 23
Blog Entries: 2

Rep: Reputation: Disabled
Thumbs up Thanks, Stabu!

Your solution works well. I rewrite it:
1. F9 / 2. Enter / 3. Info / 4. Select the file / 5. F6 / 6. Write the new name / 7. Enter
 
Old 02-01-2013, 09:57 PM   #11
hpsmouse
LQ Newbie
 
Registered: Aug 2009
Location: China
Distribution: ubuntu
Posts: 11

Rep: Reputation: 2
I just found a much simpler method: Shift + F5/F6. It keeps the original file name. Hope it helps.

There's even a ticket for this feature on MC's project page, despite that the feature is already there. I think they really should improve their manuals and tutorials.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
midnight commander save settings makes new ini file dinges Linux - Software 0 11-25-2004 10:41 AM
midnight commander prevoo DamnSmallLinux 6 09-19-2004 04:26 PM
midnight commander archlyric Linux - Software 2 02-28-2004 02:04 AM
midnight commander enigma1 Linux - Software 6 12-10-2003 02:47 PM
Midnight Commander XPediTioN Slackware 2 07-12-2003 11:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration