Re: renaming many files

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

 



Tim here.  If you have the "rename" package installed

  apt-get install rename

it's as easy as

  rename 's/^renewal talk //' "renewal talk "*

(it has a lot more power under the hood, being able to tap the full
power of perl in how the filename is modified, but stripping off an
initial prefix is an easy use-case)

If you don't, you can use shell modifiers in a for-loop

  for f in renewal* ; do mv -vi "$f" "${f#renewal talk }" ; done

Hope this helps,

-Tim

On January 22, 2021, Linux for blind general discussion wrote:
> I have many files in one directory which have the same two words in
> the beginning of the name. renewal talk 01 eating better
> renewal talk 02 exercise
> and so on.
> With the command line, is there a way of getting rid of ‘renewal
> talk’ for all files and keeping the other words in their names?
> 
> 
> _______________________________________________
> Blinux-list mailing list
> Blinux-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/blinux-list


_______________________________________________
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]