rsync is a nice idea..but dont know how to exclude a file. I use rsync like following:
rsync -av source destination ex: for remote rsync rsync -av tobesynched_dir remotelocation@ip:/path/to/be/copied/ But how to exclude a file in my problem If I did rsync -av user@remotelocation:/usr1/data/*/temp/MAST* . all MAST and .idx will synch ?? On Thursday, 29 January 2015 09:31:00 UTC+5:30, Network Ninja wrote: > > Sounds like to need to combine a few commands. Trying playing around with > something like this: > > for i in $(find /usr1/data/*/temp/MAST* MAST* | grep -v .idx); do cp $i .; > done > > A quick breakdown: > - for i in...this will repeat the command for each file that is output > from the next part > - $(find /usr1/data/*/temp/MAST* MAST*...will recursively list all the > files that match the path and name > - | grep -v .idx) will strip off any files with .idx > - do cp $i .; done...will copy the found file to the local directory (.), > and then repeat the whole process again for the next found file. > > Alternatively, you might want to look at rsync, since it has an exclude > option to not copy files that match a pattern. > > > Jeremiah Bess > > <https://plus.google.com/u/0/103182072532361592558> > <https://www.facebook.com/jeremiahbess> > <http://www.linkedin.com/profile/view?id=47451026> > > On Wed, Jan 28, 2015 at 5:08 PM, koti <[email protected] <javascript:>> > wrote: > >> Hi all, >> >> I seek your help to copy a similar file from different directories. >> >> Ex: >> >> The file locations are like .. >> >> /usr1/data/111/temp/MAST111 >> /usr1/data/222/temp/MAST222 >> /usr1/data/333/temp/MAST333 >> >> the temp dir is also having the MAST* index file also. I mean MAST111.idx >> >> what I am doing >> cp -p /usr1/data/111/temp/MAST111 . >> .. >> .. >> if I tried by doing a single command like >> >> cp -p /usr1/data/*/temp/MAST* . >> >> this will also copy the index file too. But I dont want the index file. >> How to >> copy the require file with shortest possible method? >> (of course i can remove the copied *.idx file with rm -f *.idx, give me a >> method without using the rm) >> >> Thank you >> >> >> >> >> >> >> -- >> -- >> You received this message because you are subscribed to the Linux Users >> Group. >> To post a message, send email to [email protected] >> <javascript:> >> To unsubscribe, send email to [email protected] >> <javascript:> >> For more options, visit our group at >> http://groups.google.com/group/linuxusersgroup >> References can be found at: http://goo.gl/anqri >> Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules >> or http://cdn.fsdev.net/List-Rules.pdf) >> >> --- >> You received this message because you are subscribed to the Google Groups >> "Linux Users Group" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup References can be found at: http://goo.gl/anqri Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf) --- You received this message because you are subscribed to the Google Groups "Linux Users Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
