Skip to main content
2 votes

removing hidden control characters in filenames

With zsh: autoload -Uz zmv zmv -n '(**/)(*[^[:print:]]*)(#qD)' '$1${2//[^[:print:]]}' Technically, we could just do: zmv -n '(**/)(*)(#qD)' '$1${2//[^[:print:]]}' But having the glob be more ...
Stéphane Chazelas's user avatar
1 vote

Is there a port of the Windows' REN command for Unix-like operating systems?

Probably the closest are the rename command from the util-linux package - which to avoid conflict with the Perl-based file-rename is sometimes installed as rename.ul - or the mmv command. For example ...
steeldriver's user avatar
  • 81.9k
1 vote

How to write an alias or bash script that renames a single file using the same syntax as the `ren` command of Windows?

Bash brace expansion can be used: To rename path/to/foo.txt to path/to/bar.txt we can generate these two paths from their common parts like this: $ mv path/to/{foo,bar}.txt Brace expansion doesn't ...
Kaz's user avatar
  • 8,585
1 vote
Accepted

How to write an alias or bash script that renames a single file using the same syntax as the `ren` command of Windows?

I'm not particularly familiar with REN but it looks like the directory path provided in the first argument is where the renamed file should still end up. The native solution could be something like ...
Chris Davies's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible