[Solved] Copy Problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] Copy Problem
# 1  
Old 09-25-2013
[Solved] Copy Problem

I facing a problem :

I have a Source and Destination directory. The Source directory is linked to SVN and is updated by the Script to Head Revision.

After that i copy the Source to Destination by this command:

Code:
cp -r /SOURCE PATH /DESTIUNATION PATH

Now if a delete a file in source and run the above copy command its not getting deleted in DESTINATION. They are present with earlier dates in Destination path.

How to overcome this? Copy i guess is just replacing the new files and not deleteing the older files in Destination.

Last edited by Don Cragun; 09-27-2013 at 08:56 AM.. Reason: Mark thread solved.
# 2  
Old 09-25-2013
rsync is the tool you want.
It has multiple options which free the programer from writing thousands lines of shell code to accomplish these kind of tasks.

Hope that helps.
Regards
Peasant.
# 3  
Old 09-25-2013
Quote:
Originally Posted by Peasant
rsync is the tool you want.
It has multiple options which free the programer from writing thousands lines of shell code to accomplish these kind of tasks.

Hope that helps.
Regards
Peasant.
I absolutely agree Smilie.
# 4  
Old 09-27-2013
It worked thanks Smilie
# 5  
Old 09-27-2013
Please modify the title of this thread by adding [SOLVED] before the current title, so that this thread will serve as a reference for other users in the future. BTW, glad it worked!
This User Gave Thanks to gacanepa For This Post:
# 6  
Old 09-30-2013
Code:
rsync -avz --delete --exclude=.svn /LOCAL_REPOS_PATH /Destination_SERVER_PATH

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] Need help to copy files to another server

Hi all, I need a shell script to compress and transfer only last modified(new) file from one linux server to another linux sever. the files i need to backup are 2 files .txt & .log which will be created in the same folder for every 3-4hrs and this script need to run once in 24hrs. so only... (5 Replies)
Discussion started by: basszzz
5 Replies

2. UNIX for Dummies Questions & Answers

[SOLVED] Copy subfolder to another directory preserving parent name

Hi, I have the following folder structure: Folder6100/Data Folder6100/Data Folder6120/Data Folder6120/Data Folder6140/Data Folder6140/Data Folder6160/Data Folder6160/Data Folder6180/Data Folder6180/Data Folder6200/Data Folder6220/Data Folder6240/Data Folder6260/Data... (2 Replies)
Discussion started by: alex2005
2 Replies

3. Emergency UNIX and Linux Support

[Solved] Mysql - Take data from row and copy it to another row

Sorry if I repost my question in this section, but I'm really in a hurry since I have to finish my work... :( Dear community, I have a table with two rows like: Row1 Row2 ======= ======= 7,3 text 1 1,3 text 2 1,2,3 blabla What i need to do is add/copy... (2 Replies)
Discussion started by: Lord Spectre
2 Replies

4. UNIX for Dummies Questions & Answers

[Solved] Copy question

I was reading man for cp, and I found the option cp -d. What does it mean? According to the documentation -d is the same as --no-dereference --preserve=link. I understand that --preserve preserves the attributes of the file such as time stamp, but I have no clue about neither --preserve=link... (2 Replies)
Discussion started by: santiagorf
2 Replies

5. Shell Programming and Scripting

[Solved] SFTP problem

Hi, I'm new to sh scripting and have the following problem. I have a script to sftp that is now working with ssh key. But i need to change this, i wan't to sftp with a password. I have the following script, tried a lot to make a variabel for the password. But i can't make it work ... (2 Replies)
Discussion started by: kvhindex
2 Replies

6. Shell Programming and Scripting

[solved] Problem with find

hi All, I am using the command find /home/mqm/check/ -mtime +1|wc -l to get a count of the files older than a day under the check directory. But instead of getting the count of the files under check directory I m getting a count including the check directory itself. Can someone please tell... (0 Replies)
Discussion started by: jayii
0 Replies

7. Shell Programming and Scripting

[Solved] copy + rename

Hi, I was thinking that this should be a synch but I could never get it to work. I want to copy a bunch of files within a directory (3/4 levels into the directory) to a common place. All these files have the same name, so I prefer to rename them with the path. I tried with files=`ls -1... (5 Replies)
Discussion started by: jamie_123
5 Replies

8. UNIX for Dummies Questions & Answers

SOLVED: Join problem

Hello, Going through book, "Guide to UNIX Using Linux". I am doing one of the projects that has me writing scripts to join files. Here is my pnumname script and I am extracting the programmers names and numbers from the program file and redirecting the output to the file pnn. I then created a... (0 Replies)
Discussion started by: thebeav
0 Replies

9. AIX

Problem Solved

Generally, most people, I guess, go from 5.3 ML4 Directly to TL 7. So they may never run into this issue. For the rest of us, here is the resolution of my problem in going from ML6 to TL7. Apparently with the change from ML to TL IBM added a "BuildDate Verification" routine into... (1 Reply)
Discussion started by: mrmurdock
1 Replies
Login or Register to Ask a Question