Back to Troubleshooting

How To Work With Hidden Files

Many times you will want to use a command with a * inside a folder, such as

cp -a /folder1/* /folder2/

But this does not grab the hidden files, such as .htaccess from folder 1. Note that .htaccess files in sub-folders will be grabbed when the entire folder is grabbed. I would also like to mention that you should NEVER use .* or *.* since this will allow your command to “escape” the current directory by accessing.

You can grab the entire directory, for example:

mv ~/ ~/public_html/folder/

But this can cause issues as well with permissions or ownership in some cases.

Here is a command that sets your command line up to grab the hidden files correctly. Just run

shopt -s dotglob

This command will allow you to use a command like the following to get all of the contents, including hidden files.

mv ~/* ~/public_html/

Related Articles

How To Know If My Server Is Down
Account Suspension Help
How To Fix A Broken Website
How To Resolve The HTTP Error 403 Forbidden
How To Restore An SQL Database In cPanel

Can’t Find what you need?

No worries, Our experts are here to help.