2

I have a directory like Photo

Directory Picture!

and I want to change the names of the directories inside it -> to what they are, but without it [www.faraDa...] like the first one that I change by mv command. but I dont know how remove [www.faraD...] automatically ? can do this by find ... -exec or mv in linux command or I need programing like python? to do it.

Update : in ubuntu 20.04 LTS

names are : FVLNX9510 Atoz [www.FaraD...‍‍ They have a difference in the middle part of their name A,B,C,D,....

Thank you all !

3
  • Please edit the question and clarify like Ubuntu version and some other details
    – Error404
    Nov 13, 2021 at 10:02
  • I'd suggest using the rename command, but I don't understand your wanted name change sorry.
    – guiverc
    Nov 13, 2021 at 10:03
  • @Algnis Ok,I add system info in it but its Normal ubuntu.
    – Sir-Sorg
    Nov 13, 2021 at 15:44

1 Answer 1

1

If the string to change is always the same in all files you could use this command:

rename \[www.website\]  '' *

This command works on Fedora 33 actually (I thought it was the same on Ubuntu), however this answer provides an extensive description on how to use rename on Ubuntu. I think that the command I wrote above should change in something like:

rename 's/\[www\.website\]//' *

Here you can find a description of different rename packages.

7
  • 1
    I think most people associate rename with Perl File-Rename with slightly different syntax. If you could state which rename command you use.
    – user986805
    Nov 13, 2021 at 10:58
  • You are right, sorry! Let me edit my answer.
    – overmach
    Nov 13, 2021 at 11:03
  • thank,but its different -> its is : FVLNX9510 Atoz [www.FaraD...‍‍ They have a difference in the middle part of their name - A B C D E F G ...
    – Sir-Sorg
    Nov 13, 2021 at 15:49
  • @Sir-Sorg ok but if you need to remove the part between brackets [...] the command I posted above should do the work.
    – overmach
    Nov 14, 2021 at 9:55
  • @overmach OK,I test it.but can do this by function of bash?
    – Sir-Sorg
    Nov 14, 2021 at 11:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .