Rename all hidden directories created by GNU parallel

If the only issue is that the directories are hidden, you can just remove the . from the beginning of their name to make them unhidden. For example, using perl-rename (called rename on Ubuntu):

rename 's/^\.//' '.\_Validate'*

Or, with just shell tools:

for dir in '.\_Validate'*; do echo mv "$dir" "${dir//.}"; done

Bot of these leave you with horrible directory names though, with spaces and slashes and other unsavory things. Since you're renaming, you may as well rename to something sane:

rename 's/^\.\\//; s/\s+/_/g' '.\_Validate'*

That will result in:

$ ls -d _*
_ValidateAll.sh_GL_100  _ValidateAll.sh_GL_107  _ValidateAll.sh_GL_114
_ValidateAll.sh_GL_101  _ValidateAll.sh_GL_108  _ValidateAll.sh_GL_115
_ValidateAll.sh_GL_102  _ValidateAll.sh_GL_109  _ValidateAll.sh_GL_116
_ValidateAll.sh_GL_103  _ValidateAll.sh_GL_110  _ValidateAll.sh_GL_117
_ValidateAll.sh_GL_104  _ValidateAll.sh_GL_111  _ValidateAll.sh_GL_118
_ValidateAll.sh_GL_105  _ValidateAll.sh_GL_112  _ValidateAll.sh_GL_119
_ValidateAll.sh_GL_106  _ValidateAll.sh_GL_113  _ValidateAll.sh_GL_120

IMPORTANT: note that I am not checking for file name collision. If you rename one of these to something that already exists, then you will overwrite the existing file.


You can use GNU Parallel:

parallel mv {} '{=s/^\.\\_//=}' ::: '.\_ValidateAll'*

This will remove .\_ from the names.

To also replace spaces with _ run:

parallel mv {} '{=s/^\.\\_//; s/\s/_/g=}' ::: '.\_ValidateAll'*

In principle (and as you probably know), files and directories are hidden if their name starts with a .. Thus, you can make them "visible" again by removing that .. It can be done in bash using, the builtin string manipulation functions:

user@host$ for dir in '.\_ValidateAll'*; do newname="${dir#.}"; mv "$dir" "$newname"; done

You would be well-advised, however, to verify it works correctly by trying it beforehand with

user@host$ for dir in '.\_ValidateAll'*; do newname="${dir#.}"; echo "rename $dir to $newname"; done

Update: you should definitely follow the advice in @terdon's answer to make use of the opportunity and get rid of all special characters in that process.