I have recently started using wget to download files.

I'm using ubuntu 16 mate to manipulate my files.

I create custom urls to include specific information that I want saved to the downloaded file name as follow:


If I download the url using Firefox and Downthemall using rename masks to add query strings to the file name I can manage to get:


If I download the same urls using wget (which does not appear to support rename masking) I end up getting:


I there a way to batch rename files as follows:





I want to move the text after the @ to the beginning and then remove the @.

I have lots of files I want to rename in terminal in ubuntu - if I could add it to a bash script it would be awsome.

I run ubuntu and windows and I have not found a windows program that will rename files in this way.

Thanks in advance.


Ubuntu 16.04 should come with both the original perl-supplied prename and its newer replacement rename, either of which should work with a standard sed-like substitution expression

prename -n 's/(.*)@(.*)/$2$1/' *@*


rename -n 's/(.*)@(.*)/$2$1/' *@*

You could also install mmv from the repository, and use

mmv -n "*@*" "#2#1"

In all cases the -n is a no-operation flag for testing - remove it once you are absolutely sure that the it's going to do what you want

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.