News for hackers. Stuff that matters.
Re:A terminal file manager written in bash by em-bee on Wednesday October 24, 2018 @12:06PM (#18293644)
given that this is only 100 lines of code i am quite impressed.

however, i miss one feature for which i'd use a filemanager: in-place file renaming. in most cases when i want to rename a file, i want to change a small part of it, and i don't want to have to retype the whole filename.

i have yet to find a commandline utility (emacs doesn't count ;-) that offers that.

Re:A terminal file manager written in bash by Lio on Wednesday October 24, 2018 @12:50PM (#18294113)
No need for a filemanager for in place file renaming. For that I'd just use curly bracket in bash or zsh.

e.g.

  mv /path/to/file{-old-name,-new-name}.txt
which expands to:

  mv /path/to/file-old-name.txt /path/to/file-new-name.txt

So use tab completion to get your path then go back and stick your curly brackets into it as needed. Oh and it works for things like git branch renaming or anything else you do in the terminal.
Re:A terminal file manager written in bash by JNRowe on Wednesday October 24, 2018 @01:00PM (#18294220)
If you're a zsh user you can also use the other zshparam(1) stuff too. Like "mv file.ext{,(:r)}" to perform "mv file.ext file", or :l to lowercase a filename, or any number of other sometimes useful or often pointless things ;) I've used :l a number of times, but :s for substition is probably the most useful in general.
Re:A terminal file manager written in bash by em-bee on Wednesday October 24, 2018 @01:34PM (#18294556)
thanks, but that takes more conscious effort to get right that is worth it for me. i tend to just copy the filename twice and then edit the second version to the target.

but now i'll become good friends with qmv

greetings, eMBee.

Re:A terminal file manager written in bash by JNRowe on Wednesday October 24, 2018 @12:53PM (#18294136)
If I'm understanding you correctly, then imv[1] is a great tool for this. 'imv $filename' pops you in to a readline enabled prompt to edit $filename. Given that it is readline you can even add extra options in your ~/.inputrc to add additional features to it, I have mappings for custom dir prefixes as an example.

It also comes with qmv, which will pop open an editor for you to perform inplace edits on filenames. Which is kinda like dired as an emacs comparison, at least if you squint an awful lot.

1. http://www.nongnu.org/renameutils/

Re:A terminal file manager written in bash by em-bee on Wednesday October 24, 2018 @01:22PM (#18294433)
those are exactly like what i had in mind. thanks!

qmv even handles swapping filenames which ranger doesn't.

greetings, eMBee.

Re:A terminal file manager written in bash by Beldin on Wednesday October 24, 2018 @02:34PM (#18295118)
Tab is your friend! At least in zsh it manages file name completion well - including cycling through options of there is more than 1 match for your partial name.

Of course, you could get more advanced with parameter tricks, eg. ${i%.ps}.pdf for changing the extension of $i from ps to pdf. (Technically: truncating the ending iff it matches ".ps" and adding ".pdf" no matter what.)

Re:A terminal file manager written in bash by peff on Wednesday October 24, 2018 @02:05PM (#18294849)
Perl has shipped with a `rename` utility for ages, that you can use like:

    rename 's/foo/bar/' *.ext
Of course you have to know Perl...
Re:A terminal file manager written in bash by heavenlyblue on Wednesday October 24, 2018 @12:10PM (#18293698)
Put the filename into a shell variable, then sed or split it into characters and then concat.
Re:A terminal file manager written in bash by em-bee on Wednesday October 24, 2018 @12:15PM (#18293746)
looks like ranger does it. i'll have a closer look at that