User Tools

Site Tools


ubuntu:file:rename_replace_all_occurrences_of_string_within_a_filename

This is an old revision of the document!


Ubuntu - File - Rename replace all occurrences of string within a filename

Replace spaces in a filename with hyphens

for f in * ; do mv "$f" $( echo $f | tr ' ' '-' ) ; done

Using perl

rename 's/ /-/g' *

As long as you have perl based rename. You can check: =$ rename –help Unknown option: help Usage: rename [-v] [-n] [-f] perlexpr [filenames] That's the good one.

ubuntu/file/rename_replace_all_occurrences_of_string_within_a_filename.1581636954.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki