LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   check for matching files when comparing directories (https://www.linuxquestions.org/questions/linux-general-1/check-for-matching-files-when-comparing-directories-58599/)

WarriorWarren 05-07-2003 12:54 PM

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

acid_kewpie 05-07-2003 01:13 PM

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...

Crashed_Again 05-07-2003 01:14 PM

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.

WarriorWarren 05-07-2003 01:40 PM

thanks the cp -i works great


All times are GMT -5. The time now is 06:46 AM.