hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : A question regarding cp command
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

A question regarding cp command

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 05-03-2007, 06:21 PM
nabeelamjad nabeelamjad is offline
WHT Addict
 
Join Date: Nov 2006
Posts: 126

A question regarding cp command


Hi,
i have a problem

for example my current path in server is
root@server [/home/user1/public_html/upload]#
and i wanna copy every thing inside directory upload to /home/
user1/public_html/
but when i used this command
root@server [/home/user1/public_html/upload]#cp -r -f *.* /home/user1/public_html/

then it just copy files . is there is any way to copy folder as well ???


Last edited by nabeelamjad; 05-03-2007 at 06:32 PM.
Reply With Quote


Sponsored Links
  #2  
Old 05-03-2007, 07:11 PM
duplu duplu is offline
Junior Guru Wannabe
 
Join Date: Aug 2006
Location: Milton Keynes, UK
Posts: 52
To copy everything to the directory below use:

root@server [/home/user1/public_html/upload]#cp * -R ../

or to just move it use:

root@server [/home/user1/public_html/upload]#mv * ../

Reply With Quote
  #3  
Old 05-04-2007, 12:04 AM
SparkSupport SparkSupport is offline
Web Hosting Master
 
Join Date: May 2006
Posts: 646
Quote:
Originally Posted by duplu View Post
To copy everything to the directory below use:

root@server [/home/user1/public_html/upload]#cp * -R ../

or to just move it use:

root@server [/home/user1/public_html/upload]#mv * ../
But, that will NOT copy/move the hidden files ( files that starts with a "." ) under "upload" dir. You will have to deal with them seperately.

__________________
SparkSupporT
http://sparksupport.com
sales@sparksupport.com
1- 408-335-0493

Reply With Quote
Sponsored Links
  #4  
Old 05-04-2007, 12:54 AM
Domainitor Domainitor is offline
Web Hosting Evangelist
 
Join Date: Jun 2005
Posts: 531
Why not use

root@server [/home/user1/public_html/upload]# mv `ls -A` ..

That'll get everything....

Reply With Quote
  #5  
Old 05-05-2007, 01:03 AM
jexxie jexxie is offline
Junior Guru Wannabe
 
Join Date: Dec 2006
Posts: 38
Or we could just copy it all in a nice command:
Code:
cp -R * .* ../

Reply With Quote
  #6  
Old 05-05-2007, 09:09 AM
Domainitor Domainitor is offline
Web Hosting Evangelist
 
Join Date: Jun 2005
Posts: 531
If you don't mind error messages ("cp: ../. and .. are identical (not copied).") then jexxie's command is fine. If this'll be in a script the error may be disconcerting....

Reply With Quote
  #7  
Old 05-05-2007, 10:15 PM
sanjuabraham sanjuabraham is offline
Newbie
 
Join Date: Jan 2007
Posts: 9
Hello,

You can use the following command


root@server] cd /home/user1/public_html/upload

cp -pr * /home/user1/public_html/

Thanks

Reply With Quote
  #8  
Old 05-06-2007, 05:14 AM
jexxie jexxie is offline
Junior Guru Wannabe
 
Join Date: Dec 2006
Posts: 38
ok, here's the command with the errors stripped/redirected away:
Code:
cp -R .* * ../ 2>/dev/null

Reply With Quote
  #9  
Old 05-06-2007, 07:02 AM
amr922 amr922 is offline
Junior Guru Wannabe
 
Join Date: Dec 2004
Posts: 34
use rsync
Regards ,

__________________
Amr
http://www.Venatra.com
Venatra.com .:. Specializing in VPS Hosting

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
The Value of Your Intellectual Property Blog 2013-05-06 17:43:13
Joomla Hosting Study Shows Speed, Uptime Top Selling Points of a Web Host Web Hosting News 2012-11-07 15:06:36
Rackspace Blog Looks at Easy Outsourcing for App Development Blog 2012-03-05 19:07:48
InterNetX Launches Server Administration Software Web Hosting News 2011-12-22 22:06:48
Blackberry the UnCloud Blog 2011-10-14 15:28:54


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?