- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: scp command to exclude particular directory
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2010 05:31 AM
тАО05-06-2010 05:31 AM
Please adivce, i have to copy all directories & files under directory to remote server but wanna exclude 1 directory.
kindly confirm the scp command option.
else i am thinking of making 1 server as nfs & mount the fs & then start copy with cp.
but cp too doesnt have exclude option .
rsync is having but --exclude doest recognize the PATTERN directory name.
can any confirm the correct command & syntax.
for exclude sigle directory....
Solved! Go to Solution.
- Tags:
- scp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2010 06:03 AM
тАО05-06-2010 06:03 AM
Re: scp command to exclude particular directory
scp do not have any include exclude option and that is why rsync can be use.
> rsync is having but --exclude doest recognize the PATTERN directory name.
What patern you are trying. To exclude any directory you can use the --exclude option with rsync.
You have to the exclude option with double quote that will match the regex. Also you must put the / in the directory you want to exclude:
Ex:
# rsync -avz --exclude=sapr1/ --exclude=saparch1/ source_host:/data/ target_host:/data/
Hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2010 06:09 AM
тАО05-06-2010 06:09 AM
Re: scp command to exclude particular directory
http://lists.samba.org/archive/rsync/2002-June/002970.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2010 06:20 AM
тАО05-06-2010 06:20 AM
Re: scp command to exclude particular directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-06-2010 11:26 PM
тАО05-06-2010 11:26 PM
Re: scp command to exclude particular directory
Or use pax(1) or gnu tar and exclude that directory when you create the tarfile (or when you extract.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2010 04:00 AM
тАО05-07-2010 04:00 AM
Re: scp command to exclude particular directory
I have boxA
I want to copy over boxA:/opt/stuff to boxB:/mydir/stuff
I want to exclude subdirectory /opt/stuff/racerX
I want to exclude any file with the word BLUE in them.
on boxA
cd /opt
find ./stuff -print > /tmp/stufflist.txt
cd /tmp
edit text file ./stufflist.txt
remove subdirectory ./stuff/racerX
remove any lines with BLUE in them
save the file
Log into box B
cd to mydir
Just sit there.
Go back to box A.
--Now here comes the magic part--
cat ./stufflist.txt | cpio -odumc | /usr/bin/ssh \
-2 \
mylogin@boxB \
"cd /mydir/.
/usr/bin/cpio -idumc"
BUT! be careful. I'd start with just 2 or 3 files and directories.
SMALL ones.
Make sure it works.
Then move to larger things.
Now other guys... This has worked fine for me. But perhaps there is something wrong? Let me know.
Oh...
The find command will not follow links unless you tell it to. And I would NOT tell it to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2010 12:01 PM
тАО05-07-2010 12:01 PM
Re: scp command to exclude particular directory
scp -r $(ls | -e /directory_not_to_copy/d) remote:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2010 12:14 PM
тАО05-07-2010 12:14 PM
Re: scp command to exclude particular directory
scp -r $(ls | sed /directory_not_to_copy/d) remote:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2010 12:24 PM
тАО05-07-2010 12:24 PM
Solution# scp -r $(ls | grep -v -e dir_to_exclude1 -e dir_to_exclude2 ) trg_host:/trg_dir/
Hth,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-07-2010 12:27 PM
тАО05-07-2010 12:27 PM
Re: scp command to exclude particular directory
find /stuff > filelist.txt
vi filelist.txt
scp -r $( cat filelist.txt ) trg_host:/trg_dir/