help on find with chmod.. urgent help needed


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users help on find with chmod.. urgent help needed
# 1  
Old 03-28-2005
Question help on FIND with CHMOD.. urgent help needed

Hello to all Unix gurus..

I am writing a generic script which takes the options of unix command as input and concatenate all the pieces and forms a complete executable command.

I am getting an error with the following command as I am resetting my own permission on the root directory. When the complete command is in place. It takes the shape of..

find /applications/inventory/store -name "*" -exec chmod 664 {} \; -print

The command should chmod 664 to all the sub-directories in the main directory store. but once it chmods the store directory. It will not enter into the sub-directories... what's the way out with find command..so that it starts out from the last node on a given PATH.

Besides chmod, this command takes care of few other commands(actions) as well.

Thanks for reading such a big question and hope someone will come out with a solution. Smilie

Last edited by sdlayeeq; 03-28-2005 at 04:14 PM..
# 2  
Old 03-28-2005
You will be running into problems here because the command you have run here has removed the exec flag from the files AND directories and so find will not be able to read the contents of the directory. You can do this, but only once...are you really sure that's what you want?

find /applications/inventory/store -name "*" -depth -exec chmod 664 {} \; -print
# 3  
Old 03-28-2005
Is there a better way of doing the same task

Thanks borg.. I applied the same solution -depth.. I could see the problem, I can only run it once. The next time the same command will not be executed as it will not have execute permission. Is there a better way of doing the same task.
bye
# 4  
Old 03-28-2005
assuming it is only the files you want to change:

find /applications/inventory/store -type f -exec chmod 664 {} \; -print
# 5  
Old 03-28-2005
MySQL I need to chmod directories and validate the user of the script.

Thanks borg for the reply, The task given to me is to chmod directories files, and I am looking for alternate ways of doing that. I am also looking to validate if the person executing the command does have the permission to that, then execute the command.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Urgent Help needed...

Hi I want to create a script which deleted files in the following folders older than 30 days. There are a particular version of files inside it to be deleted Folders : /files0/interfaces/ResponsysSavedList/BackInStock/EmailContent/backup... (3 Replies)
Discussion started by: Scudza
3 Replies

2. Shell Programming and Scripting

Urgent Help needed !!!

Hi, I have a directory, where i get 4 files for each day... The files will be generated at any time. I am trying for a shell script for copying the file from this directory whenever new file is generated. Say for example : If the directory X has following files A1,A2,A3,A4,B1,B2,B3,B4...... (2 Replies)
Discussion started by: krishh.kk
2 Replies

3. Shell Programming and Scripting

Find and automatically chmod

Hello everyone, my friend is asking for yOur Help. He is asking the script for combined find and changemode utility... Thank you (4 Replies)
Discussion started by: iennetastic
4 Replies

4. Shell Programming and Scripting

Urgent Help needed please

Hi, I have a small grepping problem in my script.I am having a file from which i need to make sure "#^A17" is the last updation (Next # can be ignored) before ################.The idea behind this is, if this file contains "A17" as the last updation, i need to do a particular activity. please... (7 Replies)
Discussion started by: Renjesh
7 Replies

5. Shell Programming and Scripting

Urgent Help Needed.

Hi, Below is my issue which I desperately need and I want a shell script which can do this job. I need this script as I m planning to put this for a system health check. Please assist me. 1. There are 10 log files in a particular location. 2. open each log file. Goto to the end of the... (1 Reply)
Discussion started by: kashriram
1 Replies

6. UNIX for Advanced & Expert Users

Urgent help needed!!!

-------------------------------------------------------------------------------- hy guys, i got few interview questions i need someone to answer urgently: 1)If you cant get to the root, you try to fsck it, but gets errors to read file systems. What steps do you take to recover the host... (1 Reply)
Discussion started by: charneet
1 Replies

7. Windows & DOS: Issues & Discussions

Urgent XP help needed Please

Hi, Please accept my apologies if I have not explained anything clearly enough but i am a little old on new lingo!!! I am running XP from home and last night the following happened. After being logged on for pretty much the full day, I had what seemed like a pop up come up. Although most pop... (3 Replies)
Discussion started by: nike1601
3 Replies

8. Shell Programming and Scripting

FIND/CHMOD combined

I am trying to change permission for all subdirectories and files inside folder1 so this is what i came with after many seraches on the internet. man find and man chmod mirc and few articles. find .public_html/folder1 -print0 | xargs -0 chmod 777 what's wrong with this command? it is FTP... (33 Replies)
Discussion started by: smoother
33 Replies

9. Shell Programming and Scripting

urgent help needed.

Ok I admit it I am stumped and I would appreciate any and all help Here is what I am trying to do. Korn Shell script I am setting a variable to another shell script that I want to invoke in my main script like so: GETDIR=/vol100/cfg/.getdir The .getdir shell script take a parameter,... (4 Replies)
Discussion started by: Batch
4 Replies

10. Shell Programming and Scripting

urgent help needed !!

i have a script, which is continuously looping. i want to view the script name when i use ps command... it is only showing -sh ... UID PID PPID C STIME TTY TIME COMMAND informix 8533 20923 0 18:19:28 pts/ta 0:00 -sh but i dont have my scriptname displayed .... how can i do that my script is... (0 Replies)
Discussion started by: guhas
0 Replies
Login or Register to Ask a Question

Featured Tech Videos