Create duplicate directories with same permissions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Create duplicate directories with same permissions
# 1  
Old 09-07-2011
Create duplicate directories with same permissions

Hi all,

I need to create duplicate directories and sub directories (only the directories not the files or file contents) with the same permissions. Can some one guide me in doing this. I could able to create but here the permissions should be the same how can i do this in linux.

Thanks in advance. Quick response is highly appreciated. Thank you so much.

Regards,
Olivia
# 2  
Old 09-07-2011
Code:
cp -ar DIR NEWDIR
find NEWDIR -type f -print0 | xargs -0 rm

I'm interested in a better solution too.
# 3  
Old 09-07-2011
Code:
rsync -vrz --copy-links --stats --exclude="*" $SOURCE/* $DESTINATION

This User Gave Thanks to itkamaraj For This Post:
# 4  
Old 09-07-2011
Quote:
Originally Posted by itkamaraj
Code:
rsync -vrz --copy-links --stats --exclude="*" $SOURCE/* $DESTINATION

It doesn't work:
Code:
$ mkdir -p a/{b,c,d} x
$ rsync -vrz --copy-links --stats --exclude="*" a/* x
...
$ ls x

nothing
# 5  
Old 09-07-2011
hmm, exclude flag is used to exclude the matching filenames. so i have given *.

i didnt verify the command
# 6  
Old 09-07-2011
Code:
rsync -a -f"+ */" -f"- *" source/ destination/

Ref: Copying directory trees with rsync -- I Still Know What You Learned Last Summer
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete duplicate directories?

Is there a way via some bash script or just cmd to find duplicate directories? i have main folders: TEST1 TEST2 In folder TEST1 is some amount of same folders as in folder TEST2 can be this done? i tried fdupe but it only search for dupe files not whle dirs thx! (8 Replies)
Discussion started by: ZerO13
8 Replies

2. Shell Programming and Scripting

Find comand directories permissions

Hi, In the code below, while the "xarsg" command does not search in "tavi_valo" subdir? IAB00201:UG02222:EXPL> ls -1|xargs -IXX find XX -name tv_va_servbonos 2>/dev/null UG02222/fuentes/TAVA/TAVA4E0000/backup/tv_va_servbonos... (2 Replies)
Discussion started by: Jose Luis
2 Replies

3. AIX

Permissions on directories and files

Hello, I have a main directory called /test123 /test123 has lot of sub-directories and files. drwxr-x--- 21 root system 4096 Jan 25 10:20 /test123 Here, "other" does not have any access to /test123 folder. How can we provide read-only access to others on /test123... (1 Reply)
Discussion started by: aaron8667
1 Replies

4. UNIX for Dummies Questions & Answers

Duplicate directories

I have noticed that the same folder (and contents) lives in /u/public and /usr/public Question was this put here intentionally or by accident? Its 31Gb in size and on a 72Gb HDD that leaves little room for apps. It is a nework shared drive for all to access e.g. p: points to... (0 Replies)
Discussion started by: moondogi
0 Replies

5. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

6. UNIX for Dummies Questions & Answers

how to change permissions only to files, not directories....?

Hi, I am really new to unix, any help is much appreciated. I need to change permissions of all files under several subdirectories to 700 but keep directories readable (755). Why ? Because I need a FTP user to only list his files and can't read them. But to browse to subfolder, the directories... (3 Replies)
Discussion started by: narrok
3 Replies

7. Shell Programming and Scripting

duplicate directories

Hi, I have file which users like filename ->"readfile", following entries peter john alaska abcd xyz and i have directory /var/ i want to do first cat of "readfile" line by line and first read peter in variable and also cross check with /var/ how many directories are avaialble... (8 Replies)
Discussion started by: learnbash
8 Replies

8. Ubuntu

Newbie, Directories permissions

Basicly im trying to edit a file for apache2 in /var/etc/apache2 and i dont have permissions, my login name is associated with root but i still can't do anything, Does anyone have any ideas? Thanks in advance! (3 Replies)
Discussion started by: sypherz
3 Replies

9. Shell Programming and Scripting

Need help in changing Permissions to 775 for files and directories

Hi All I need to create a script which would change Permissions to 775 All the Files and directories will be mentioned in the Paramter files Can anyone give a Hint how to proceed in this ?? THanks (1 Reply)
Discussion started by: ranga27
1 Replies

10. UNIX for Dummies Questions & Answers

Permissions for Directories and Subdirectories

Is it possible to have a directory owned (by root) with permissions drwx------ and then have a sub directory of rwxrwxrwx. I know that this may be soo simple but I had no luck googling it. Thanks for your help (1 Reply)
Discussion started by: clancymf
1 Replies
Login or Register to Ask a Question