문제

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top