denisidoro / navi

An interactive cheatsheet tool for the command-line
Apache License 2.0
15.21k stars 507 forks source link

FR: command to recursively lowercase a directory tree/file on the default cheats #842

Open i30817 opened 1 year ago

i30817 commented 1 year ago

Is your feature request related to a problem? Please describe. Yes. This is sooooo common when interacting with data that comes from windows/DOS that needs to be massaged for unix utilities/programs and it's always annoying remembering it.

Describe the solution you'd like Something like

find <chooser> -depth -exec rename 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;

But safer in that if there are files that would be clobbered (because there are mixed case files, some of which that would end up the 'saved over') it refuses to progress and just presents a list of files that could be clobbered for the user to manually fix. So two passes.

Also a 'non-interactive' version for scripts where a strategy to deal with conflicts is selected (most recent probably, if there doesn't need to be more configuration).

I'd also like it if the interactive version tested for required sudo (besides case conflicts) and asked for it if necessary i guess.

Describe alternatives you've considered I usually just 'remember' the command and invoke it, but i'd appreciate a way to use some kind of filechooser (if possible), and if not use $PWD and at least make sure that files wouldn't be clobbered by the operation. I usually don't care about race conditions on this because it's usually data that is not being operated on by programs, and in most cases it's going to be read only anyway (usually games).

i30817 commented 1 year ago

edited the RFE to focus on the 'to lowercase' interesting case and to ask for a second version that is suited for non-interactive scripts which has a 'autoresolve' capability when there is a conflict lowercasing instead of a 'stop progressing if there would be clobbering' of the default version.