LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-07-2003, 12:54 PM   #1
WarriorWarren
LQ Newbie
 
Registered: Apr 2003
Posts: 17

Rep: Reputation: 0
check for matching files when comparing directories


hi,

I am making a shell script to back up one directory to another, how could i compare directories and inform myself if there are any matching files that will be over written
 
Old 05-07-2003, 01:13 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
i've not tried it really, but i'd suggest that you might just want somethign as simple as "cp -uv" this will only overwrite old files, and presumably the verbose output will easily tell you which ones are over written. unless you require some sort of verification before it happens...
 
Old 05-07-2003, 01:14 PM   #3
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
I think you would want to use the 'diff' command. Check out the man pages for its uses. If you are just using the 'cp' command then you can add the -i switch to be prompted before overwriting files. I'm not sure if thats what your looking for though.
 
Old 05-07-2003, 01:40 PM   #4
WarriorWarren
LQ Newbie
 
Registered: Apr 2003
Posts: 17

Original Poster
Rep: Reputation: 0
thanks the cp -i works great
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
Comparing 2 Files for Duplicates Mr_H Linux - Newbie 5 11-09-2005 12:43 PM
comparing lots of files Frustin Linux - General 4 09-22-2005 02:54 PM
Using diff for comparing 2 files beep Programming 5 01-21-2005 12:51 PM
Comparing 2 Files xianzai Programming 2 05-23-2004 11:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:31 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration