Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy permissions of entire directory tree 1

Status
Not open for further replies.

neuralnode

Technical User
Sep 12, 2007
59
PL
Hi All,

Here's the challenge:
I have two filesystem that are almost exact copies.
The only difference is that one filesystem has correct permissions on directories and files, while the other doesn't.

What I want to do is to copy all permissions from filesystem (directory tree) A to filesystem B.
I cannot copy the files/dirs themselves becuase some files on the filesystem B have already changed, and cannot be rolled back.

So I need a bash/awk/sed script that will do it with permissions only.

Would you have some ready answer for this?

Thanx in advance!
 
Hi

You say, Bash would be good, so I suppose you have other GNU tools too. See thread822-1146704 for a [tt]stat[/tt] based solution. If [tt]stat[/tt] is not available see thread822-1280463 where we discussed about extracting permissions from [tt]ls -l[/tt] output and making them suitable to be used as parameter for [tt]chmod[/tt].


Feherke.
 
Thanx, the thread has indeed answered my question!

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top