1

I am a noob, I have accomplished various things on the cli, however I haven't been able to rename some files Let me explain with an example.

I have this:

folder/
    subfolder/
        fileto_rename.txt
folder2/
    subfolder2/
        fileto_rename2.txt

I want to rename to this:

folder/
    subfolder/
        filetorename.txt
folder2/
    subfolder2/
        filetorename2.txt

I just cant for the life of me understand the instructions on how to do it with find or rename, mv says I need to provide a destination... I hope someone could help me out. Sorry for my bad English

1

1 Answer 1

0

It should be as simple as:

rename -n 's/_//' folder/subfolder/*

Remove -n when satisfied with output to do the actual renaming.

's/_//' will delete all underscore characters in file names.

folder/subfolder/* is the path to your files and * works on all files in that path.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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