LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 02-24-2005, 02:43 AM   #1
LancerNZ
Member
 
Registered: Oct 2004
Location: New Zealand
Distribution: Fedora Core 2
Posts: 40

Rep: Reputation: 15
How can I write a shell script to transfer files and keep permissions?


Searching for answers to my question, the closest I can find is linuxquestions.org/questions/showthread.php?s=&threadid=291713
(sorry that's not linked - this forum won't let me post URLs yet because of a "five post" restriction rule)

Basically I am in the process of adding ethernet to some school computers (a real relief because I've become very sick and tired of using floppies to transfer files between them) and I'm wanting to make shell scripts in order to distribute files, and later possibly work towards having a shared drive.

However, apart from running a few commands to set up the network with separate IP addys etc, I don't know much about networking.

A lot of the computers have clone directories. e.g: the students all have a /home/<student_name> dir. Depending on which computer a student was working on, files of the same name may be more up to date on one computer than another etc etc. I will want to rsync these before finally switching the contents over to a common shared drive.

.....I should say I've not used rsync before and am mainly comfortable with using commands like... \cp -purf <source_dir> <dest_dir> for this kind of operation.

How do I write a shell script which includes standard cp commands but accross networked computers?

Also - can I include options to transfer entire tree branches (subdirs) as well as preserving ownership, creation date, permissions etc?
 
Old 02-24-2005, 03:49 AM   #2
linuxxed
Member
 
Registered: Feb 2004
Posts: 273

Rep: Reputation: 30
Use scp to transfer files. If you trust your network then you can use Berkeley R commands like rcp OR simply use ftp.

To preserve permissions you may have to tar up the directory and untar on the remote host. There may be a simpler way but I can't think of one right now. Look in man pages of scp/ftp/rcp etc.

You'll have to enable these services if you want to use them.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
HELP:write a CGI program with shell script supermyself Programming 3 06-12-2005 03:10 PM
How can I write a shell script to transfer files and keep permissions? LancerNZ Linux - Wireless Networking 0 02-24-2005 12:19 AM
write a shell script to send email yenonn Programming 4 02-11-2005 10:06 PM
How to write a shell script to download a file via FTP? guarriman Linux - General 4 12-21-2004 09:31 AM
[SHELL SCRIPT] Write at the right of the shell window Creak Linux - General 2 04-02-2004 03:00 PM


All times are GMT -5. The time now is 08:55 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration