Hi,
OS - Unix, linux (all unix flavors)
My requirement. To check directory/file exists and then change the permission of the directories/files.
Iam trying to start with directory and here is my code in the file totalchange.sh (insideragain - is a directory, test1.txt - is a file under the directory insideragain)
totalchange.sh file
when i run it, i get the following error message
where am i wrong?
Next i want to check if file exists, so
totalchange1.sh
$1 = insideragain
$2 = test1.txt
if [ ! -d "$1" ]
if [ ! -f "$2"]
then
chmod 550 $2
fi
elsif
echo "directory not find"
fi
Can anyone point to right direction for both these files totalchange.sh and totalchange1.sh?
thanks
Last edited by Yogesh Sawant; 03-25-2009 at 03:09 AM..
Reason: added code tags
how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex.
so
mydemo--2015-03-23-1500.tar.gz
> database
-... (5 Replies)
Can anyone come up with a unix command that lists
all the files, directories and sub-directories in the current directory
except a folder called log.?
Thank you in advance. (7 Replies)
I am looking for a small script to crawl through several directories and change a couple of files in each directory to read write status.
Anyone have any ideas ? (5 Replies)
Hi,
Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process.
I wanted to disply using a unix command all the directories recursively excluding files.
I tried 'ls -FR' but that display files as... (3 Replies)
Hi folk,
Could you please give me command to give the rwx permissions to the parent and its sub directories ?
Is it possible to fire one command or Script for giving permission to both the parent and its sub directories.
I meant to say something like in recurcive.
I am using AIX 5.2
... (2 Replies)
hello,
i want to chmod 444 all files in a directory, files in subdirs cannot be chmoded same goes for the subdirs themself.
So using:
chmod -R 444 /dir/
won't work because it will chmod the directorys and files (together with files in subdirectorys)
I figured out how to chmod files... (1 Reply)
The man page for chmod doesn't list a way to recursively change permissions on directories only, without affecting the files themselves.
Let's say that I wanted to change the permissions on the current directory and all subdirectories. I know I can write a bash script that would do this using... (1 Reply)
I've got 100 directories that each have 2 directories with in them.
Structered like this:
/home/domains/domain1/
through to
/home/domains/domain100/
and those 2 directories mentioned above are here:
/home/domains/domain1/directory1/
/home/domains/domain1/directory2/
through to... (7 Replies)