I am using Ubuntu and Arch-based OSs and I have tons of files that I have to rename. I have used this so far.

    allfiles=$(find ./ -type f -name "*:*")

echo $allfiles

find ./ -depth -name "* *" -execdir rename 's/ /_/g' "{}" \

It has renamed the main folders, but not the subdirectories.

  • You are limiting the first find to files only, but then you talk about folders and subfolders. What do you want to rename? Folders only? Files only? Both?
    – terdon
    May 1, 2020 at 10:47
  • Elysium, what is the purpose of the first find and first echo? How are they related to your question?
    – Quasímodo
    May 1, 2020 at 11:07
  • Also, can you give us a directory structure that reproduces the problem? I can't get your command to fail on my system.
    – terdon
    May 1, 2020 at 11:23


You must log in to answer this question.

Browse other questions tagged .