The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Finding Hidden files and protecting the folder containing hidden files from deletion pochaw Shell Programming and Scripting 4 12-21-2007 09:33 PM
FTP - To handle error while transferring files mahalakshmi Shell Programming and Scripting 1 04-04-2007 12:56 AM
transferring files using ftp but mantaining the dates 435 Gavea Shell Programming and Scripting 4 07-23-2006 08:48 AM
transferring files to and from remote computer yogi1 UNIX for Dummies Questions & Answers 6 05-28-2006 06:58 PM
FTP session expiring when transferring files... Need some solution aarora_98 Shell Programming and Scripting 4 12-13-2005 09:28 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-12-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,547
Stumble this Post!
Transferring hidden files with scp

Is there a way to scp hidden files only ( with regex ) without specifying the name of the hidden files ?

Many thanks in advance !
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-12-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,812
Stumble this Post!
Define "hidden" file - one with a protection mask of 000 ?
Reply With Quote
  #3 (permalink)  
Old 01-12-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,547
Stumble this Post!
No,

files whose name starts with a "."
Reply With Quote
  #4 (permalink)  
Old 01-12-2007
Registered User
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 204
Stumble this Post!
scp .* host:/dir

you get error mes for directories . and .. but you can filter them out if you want
Reply With Quote
  #5 (permalink)  
Old 01-12-2007
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,547
Stumble this Post!
Quote:
Originally Posted by funksen
scp .* host:/dir

you get error mes for directories . and .. but you can filter them out if you want

Thanks,
But this would copy all the files not only the hidden files (filenames starting with a "." )

Am trying to copy only the files whose name starts with a "."
like,
.profile
.env
Reply With Quote
  #6 (permalink)  
Old 01-12-2007
Registered User
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 204
Stumble this Post!
a plain file that starts with a . is automatically hidden

for avoiding error mes you can use

scp $(ls -la | grep -v "^d" | awk '{print $9}' | grep "^\.") hostname:/dir
Reply With Quote
  #7 (permalink)  
Old 01-12-2007
Registered User
 

Join Date: Jan 2007
Posts: 28
Stumble this Post!
Hope this helps!

Hi,
I am using xargs to do the job! I hope this is wat u expected

ls -la | awk '{print $NF}' | egrep '^\.' | xargs -I {} -t scp {} some_machine:~/destination_folder

~Srini
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:26 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0