This worked to me:
rename 's/\.//;' .*
It looks for all files with .something
and renames to something
.
سؤال
I have a directory with more than 100 hidden folders (.folder) and I want to make them visible (folder). Is there a way to do it with one command instead of doing this for each file separately? The command I have used so far is
mv .folder folder
Please help.
المحلول
This worked to me:
rename 's/\.//;' .*
It looks for all files with .something
and renames to something
.
نصائح أخرى
I am not sure why you would want to do this but you could do the following three commands
ls -a | grep "^\.[^\.]" | sed -e "s/\.\(.*\)$/mv \0 \1/" > mv_hidden
chmod +x mv_hidden
./mv_hidden
rm mv_hidden
You might want to check that the list of command produce in the file mv_hidden looks correct by executing
less mv_hidden
To change all files in the current directory from hidden to non-hidden:
for f in .*; do
if [ "$f" != . -a "$f" != .. ]; then
mv "$f" "${f:1}"
fi
done