![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| list the files but exclude the files in subdirectories | shyjuezy | UNIX for Dummies Questions & Answers | 8 | 10-15-2008 10:42 AM |
| List only the files | chandran.m | SUN Solaris | 5 | 12-06-2007 12:03 PM |
| How to list top 10 files | satish_1983 | UNIX for Dummies Questions & Answers | 4 | 10-26-2007 05:05 AM |
| list files | alisevA3 | UNIX for Dummies Questions & Answers | 2 | 03-20-2007 11:40 PM |
| list files | avadhani | UNIX for Dummies Questions & Answers | 7 | 06-20-2005 11:25 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
list of files
Hi all
I wrote a script as a part of it the scp command copies some selected files from the source server to the target server,but now i want to display(not to the user ,but for my refernce) the list of files on the target server and remove the files that are not common in the source and target,in other words after the scp command is executed the source and traget server must have the same files.Any kind of advice is appreciated. thnks |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
You can use rsync for this. Rsync works over ssh as well. If you have to write your own script, you can do something like this:
1. ssh to remote and get list of files (use ssh and ls on remote path) 2. compare remote list with local list and create list of files to remove (files that are not present locally) (use comm command) 3. ssh to remote and remove files that are in the list (use ssh and rm on remote path) 4. scp files from local to remote (scp as in current script) |
|
#3
|
|||
|
|||
|
You could use "ssh ... find ..." to get the list of the files on both machines and use "diff" to give you the list of what the differences are.
|
|
#4
|
|||
|
|||
|
list of files
Quote:
but what i wanted was ,that i dont watn to login onto the remote server manually,i want my script to do that and it must automatically detect find out the list of files and delete the old one's on the remote server to make the list look identical on both the source and the target thnk you,its urgent so pls any kind of idea is appreciated |
|
#5
|
|||
|
|||
|
list of files
Quote:
but what i wanted was ,that i dont watn to login onto the remote server manually,i want my script to do that and it must automatically detect find out the list of files and delete the old one's on the remote server to make the list look identical on both the source and the target thnk you,its urgent so pls any kind of idea is appreciated |
|
#6
|
|||
|
|||
|
can you pls elaborate on that,as to how to find the files,pls can you give an example
|
|
#7
|
||||
|
||||
|
Quote:
|
||||
| Google The UNIX and Linux Forums |