Re: renaming many files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not sure which package provides the command, but if you have
rename.ul on your system, then

rename.ul "[oldText]" "newText" *

will replace the first instance of [oldText] with [newText] in every
filename in the working directory.

Naturally, you can replace * with, for example, *.txt if you only want
to rename text files.

If you just want to delete a common string, just make [newText] empty
by putting two double quotes with nothign between them.

Note: single quotes work as well for delimiting [oldText] and
[newText], and if there's a dash(-) in either [oldText] or [newText],
you'll need to include double dash(--) before them to avoid the shell
trying to read the dashes as flag markers. Do note that rename.ul also
only changes the first instance, so if you're using it to, for example
replace underscores in web safe filenames with spaces, you'll need to
run the command until all instances have been changed.

There are other rename tools out there, but rename.ul is particularly
good at removing a common prefix from a bunch of related files, which
sounds like your situation.

_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list




[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]