Sponsored Content
Top Forums Shell Programming and Scripting Copy one folder to multiple directories Post 302507807 by Chubler_XL on Thursday 24th of March 2011 10:40:55 PM
Old 03-24-2011
Quote:
Originally Posted by GamGom
Thank you Chubler_XL for replay
I can do that in one job for all domains? not per each domain.
The script I posted will do it for all domains (perhaps I should have worded my post more carefully).

If you tar up your directory and type the script as it is above and hit enter you will see:

Code:
$ for dir in /var/www/domain*
>do
>    cd $dir
>    printf "Extracting to $dir.."
>    tar xf /path/to/mydir.tar
>    echo
>done
Extracting to /var/www/domain1.com...
Extracting to /var/www/domain2.com...
Extracting to /var/www/domain3.com...
Extracting to /var/www/domain4.com...
Extracting to /var/www/domain5.com...
Extracting to /var/www/domain6.com...
... and so on ...

[code]
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Create Folder in Multiple Directories

Hi, I am trying to figure out how to have a folder created in multiple directories. For example /home is where we have over 1500 staff members directories, the staff members name is the name of directory under /home. I need to have a folder called "Desktop" created in every staff members directory.... (15 Replies)
Discussion started by: Stud33
15 Replies

2. UNIX for Dummies Questions & Answers

copy multiple files in different directories

I have a report file that is generated every day by a scheduled process. Each day the file is written to a directory named .../blah_blah/Y07/MM-DD-YY/reportmmddyy.tab I want to copy all of this reports to a separate directory without having to do it one by one. However, if I try cp... (3 Replies)
Discussion started by: ken2834
3 Replies

3. UNIX for Dummies Questions & Answers

Copy single file to multiple directories

Please help - I need to copy a single file to multiple directories. Dir structure: Parent_Directoy Filename1 Child_Directory1 Child_Directory2 Child_Directory3 Child_Directory4 .... So I need to copy Filename1 to all of the... (2 Replies)
Discussion started by: kthatch
2 Replies

4. UNIX for Advanced & Expert Users

Auto copy for files from folder to folder upon instant writing

Hello all, I'm trying to accomplish that if a file gets written to folder /path/to/a/ it gets automatically copied into /path/to/b/ the moment its get written. I thought of writing a shell script and cron it that every X amount of minutes it copies these files over but this will not help me... (2 Replies)
Discussion started by: Bashar
2 Replies

5. Shell Programming and Scripting

Find files of type within folder copy multiple results to different folders

Ok question number two: I'd like to search a directory for multiple file types (rar, txt, deb) and depending on what's found, copy those files to folders named Rar, TextFiles, and Debs. I'm looking for speed here so the faster the script the better. I want it to be a function that I pass 1 argument... (4 Replies)
Discussion started by: DC Slick
4 Replies

6. UNIX for Dummies Questions & Answers

Copy multiple files with space to folder

Please help , I am in an urgent need, Please help nawk '{for(i=1;i<=NF;i++){printf("%s\n",$i)}}' filename | sed 's/.*com//' | nawk '/pdf/ {printf("F:%s\n",$0)}' | while read line; do mv $line /images/; done the above script works for without spaces but,My path is also having some space... (3 Replies)
Discussion started by: umapearl
3 Replies

7. Shell Programming and Scripting

Copy files from multiple directories into one directory without overwriting them

I have several directories and all those directories have .dat files in them. I want to copy all those .dat files to one directory say "collected_directory" The problem is I don't want to overwrite files. So, if two file names match, I don't want the old file to be overwritten with a new one. ... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

8. Shell Programming and Scripting

Copy files/directories excluding multiple paterns

my directory structure is like below: basedir\ p.txt q.htm r.java b\ abc.htm xyz.java c\ p.htm q.java rst.txt my requirement is i want to copy all the files and directories... (0 Replies)
Discussion started by: ajayyadavmca
0 Replies

9. UNIX for Dummies Questions & Answers

copy file using unix in multiple directories

Hi All Genious, I want to copy a file name XYZ .In a directory /HOME/dir/IXOS1/dir1 which contain multiple directories named not in pattern want to copy the XYZ in all of the directories available on path /HOME/dir/IXOS1/dir1 . Thanks in advance . (2 Replies)
Discussion started by: mumakhij
2 Replies

10. UNIX for Beginners Questions & Answers

How to copy particular files from a multiple directories and paste in a new directory?

Dear all I have a multiple directories, say for example org1, org2, org3 ..... org100 and each directory having a file namely dnaG.fasta. I need to copy all the dnaG.fasta file from each directory and paste in another directory fastconcatg. Therefore, my script has to copy dnaG.fasta file from... (5 Replies)
Discussion started by: dineshkumarsrk
5 Replies
samba_selinux(8)					Samba Selinux Policy documentation					  samba_selinux(8)

NAME
samba_selinux - Security Enhanced Linux Policy for Samba DESCRIPTION
Security-Enhanced Linux secures the Samba server via flexible mandatory access control. FILE_CONTEXTS SELinux requires files to have an extended attribute to define the file type. Policy governs the access daemons have to these files. If you want to share files other than home directories, those files must be labeled samba_share_t. So if you created a special directory /var/eng, you would need to label the directory with the chcon tool. chcon -t samba_share_t /var/eng To make this change permanent (survive a relabel), use the semanage command to add the change to file context configuration: semanage fcontext -a -t samba_share_t "/var/eng(/.*)?" This command adds the following entry to /etc/selinux/POLICYTYPE/contexts/files/file_contexts.local: /var/eng(/.*)? system_u:object_r:samba_share_t:s0 Run the restorecon command to apply the changes: restorecon -R -v /var/eng/ SHARING FILES
If you want to share files with multiple domains (Apache, FTP, rsync, Samba), you can set a file context of public_content_t and pub- lic_content_rw_t. These context allow any of the above domains to read the content. If you want a particular domain to write to the pub- lic_content_rw_t domain, you must set the appropriate boolean. allow_DOMAIN_anon_write. So for samba you would execute: setsebool -P allow_smbd_anon_write=1 BOOLEANS
SELinux policy is customizable based on least access required. So by default SELinux policy turns off SELinux sharing of home directories and the use of Samba shares from a remote machine as a home directory. If you are setting up this machine as a Samba server and wish to share the home directories, you need to set the samba_enable_home_dirs boolean. setsebool -P samba_enable_home_dirs 1 If you want to use a remote Samba server for the home directories on this machine, you must set the use_samba_home_dirs boolean. setsebool -P use_samba_home_dirs 1 system-config-selinux is a GUI tool available to customize SELinux policy settings. AUTHOR
This manual page was written by Dan Walsh <dwalsh@redhat.com>. SEE ALSO
selinux(8), samba(7), chcon(1), setsebool(8), semanage(8) dwalsh@redhat.com 17 Jan 2005 samba_selinux(8)
All times are GMT -4. The time now is 01:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy