I made a mistake with rename command
find . -type f -exec rename 's/[^A-Za-z0-9._]//g' {} +
After that the files are not under their folders as they used to be and every file has . in front of them. Now my customers can not see the files. Once I remove the . then they can see the files.
How can I remove . from the files. Like this:
.finacialyear2008half.doc
to
finacialyear2008half.doc
Please help me! I need a fast fix.
find . -type f -exec rename 's/\.//' '{}' \;
Think about -n parameter of rename : it just display what it will do after you remove it !
Assuming you are using bash you can loop through the files replacing first occurrences of
/.
with/
in the filenames of all files in the current folder.This assumes that you don't need to recursively rename files, and will only work in current directory (
-maxdepth 1
).Disclaimer: always backup your files or at least try with a bunch of test files before performing any actions on your data.