Sign up to create your own snipts, or login.

Public snipts » gin's snipts » search & apply new perm for files in pattern

posted on Jan 05, 2010 at 6:19 p.m. EST in 
  • #!/bin/bash
    
    # Search for files with pattern name defined on name var, then
    # apply new user, group and other perms. located in path
    
    old_user='gin';
    new_user='shakka';
    
    old_group='guest';
    new_group='geek';
    
    name='*.ogg'
    path='/home/gin/video/';
    perm='700';
    
    	chmod ${perm} `find ${path} -name ${name} -user ${old_user} -group ${old_group}`;
    	chown ${new_user}:${new_group} `find ${path} -name ${name} -user ${old_user} -group ${old_group}`;
    
    exit 0;
    

    copy | embed

0 Comments

Sign up, or login to leave a comment.