Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Tag Archives: Directory

Copy recursively directory structure using Linux Command


How to copy a directory/folder structures in a single command
Create a new directory
Cd new_directory
Run the following command
Where “../catalog” is the source location
***Remember to backup before running this script.

e.g

find ../catalog -type d -printf “%P\n” | xargs mkdir -p

find ../admin -type d -printf “%P\n” | xargs mkdir -p

How to create a Password Protected Directory using linux command prompt?


Create a .htaccess file in the folder you want to set.
like:
#root@adu [/home/hostsite/public_html/admin]# vi .htaccess
copy and paste the following lines:
———————————————————-
AuthName “Secure Area”
AuthType Basic
AuthUserFile /home/hostsite/public_html/admin/.htpasswd
require valid-user
———————————————————-
Now set a password:
#htpasswd -c .htpasswd admin
New password: admin321
confirm password: admin321

You are done. test it: http://www.hostsite.com.au/admin and enter user name as admin and password as admin321