LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-01-2007, 08:56 AM   #1
walidaly
Member
 
Registered: Mar 2007
Posts: 64

Rep: Reputation: 15
copy file with extensions and permissions


is there a way to copy files from an old server to a new one with all the extensions and permissions?
 
Old 05-01-2007, 08:58 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
From a command line? Refer to the manual page for the CP command in a console, type 'man cp'. The option you likely want specifically is '-p for preserve attributes'.
 
Old 05-01-2007, 09:25 AM   #3
walidaly
Member
 
Registered: Mar 2007
Posts: 64

Original Poster
Rep: Reputation: 15
thanks for the reply, but I need to copy to a new server that means I need to tar or bzip it first
 
Old 05-01-2007, 10:05 AM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
oh OK, check out the TAR help page: 'man tar' or as suggested in the TAR documentation, run 'info' and go to the tar help page for full details.
 
Old 05-02-2007, 12:57 PM   #5
rch1231
Member
 
Registered: Mar 2007
Location: Bedford, Texas
Posts: 31

Rep: Reputation: 15
Use one of these to create a compressed tar ball file:

tar cvzf /tmp/mytarfile.tar.z /pathToDir/OrFilesIwant can be a /listOfFilesOrDirs

To check to see if the fiel created ok:

tar tvzf /tmp/mytarfile.tar.z

or to get every file in the current directory and every sub dir without the absolute path use:

tar cvzf /tmp/file.tar.z .

ftp the tar file to the new server and use this to extract them:

tar xvzf /tmp/mytarfile.tar.z

If you used the absolute path to reference the files in the tar backup make sure you are in / when you extractthe files.

tar flags:
c to create
x to extract
t to tell me what is in the file
v verbose (show me what you are doing)
z compress with gzip
f I will tel you next which file to write to.
 
Old 05-18-2007, 01:28 PM   #6
Evilliger
LQ Newbie
 
Registered: May 2007
Distribution: Fedora, CentOS
Posts: 7

Rep: Reputation: 0
You can use tar over ssh.

tar cvf - /dir |ssh host tar xvf - -C /newdir
 
Old 05-24-2007, 06:01 AM   #7
p_s_shah
Member
 
Registered: Mar 2005
Location: India
Distribution: RHEL 3/4, Solaris 8/9/10, Fedora 4/8, Redhat Linux 9
Posts: 237
Blog Entries: 1

Rep: Reputation: 34
rsync is the best option from my point of view.
1. Install/Configure rsync server on new server.
2. Run following command from old server to sync data.
rsync -rauv $DATADIR"/" NewServer::data/
 
Old 05-24-2007, 06:59 AM   #8
walidaly
Member
 
Registered: Mar 2007
Posts: 64

Original Poster
Rep: Reputation: 15
That worked, thanks a lot!
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy selected with specified file extensions dickb Linux - Newbie 4 06-25-2005 02:43 PM
Need help with File Extensions Linux nooB 454 Linux - Newbie 3 04-10-2005 05:41 PM
perl file::copy RESETs permissions. ludeKing Programming 0 01-23-2005 05:02 PM
File Extensions!!! rejeK Linux - Software 5 12-20-2004 07:30 PM
File Extensions RpgActioN Slackware 1 09-22-2004 10:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration