chmod a lot of files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting chmod a lot of files
# 1  
Old 06-12-2009
chmod a lot of files

So i have about 600gb of data.. in which there are alot of directories and alot of files.. Im trying to put this on a ftp server.. So i want to set the permissions on the directories to be 755 and the permission on the files to be 644. So i used:

Code:
find . -type d -exec chmod 755 {}\;

and
Code:
find . -type f -exec chmod 644 {}\;

The command for the files seemed to work on the majority of the files.. But the one for directories worked for like 30% of my diretories.. Can you guys recommend another way of doing this.. To make sure "all" my files are set to 644 and "all" my directories are set to 755... Thanks Smilie
# 2  
Old 06-12-2009
What is the current permission of files that are not getting changed?
# 3  
Old 06-12-2009
Quote:
Originally Posted by rakeshawasthi
what is the current permission of files that are not getting changed?
777 Smilie
# 4  
Old 06-12-2009
In my system if I do not give a space after {}, it throws an error. so try to check it.
use -print and see what files are getting changed.
from which dir are you running the command.
# 5  
Old 06-12-2009
Quote:
Originally Posted by rakeshawasthi
In my system if I do not give a space after {}, it throws an error. so try to check it.
use -print and see what files are getting changed.
from which dir are you running the command.
from the main folder
# 6  
Old 06-12-2009
Maybe spaces in the names? maybe too many execs ?

Code:
find . -type d -print | while read DIR
do
         chmod 755 "${DIR}"
done

find . -type f -print | while read FILENAME
do
         chmod 644 "${FILENAME}"
done


Afterthought: If any of the directories are links, you may need the "-follow" parameter to "find".
# 7  
Old 06-12-2009
that work thank u very much Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert a lot of files in subdirectories automatically

Hi, I have a huge structure of directories and subdirectories contsining some data. The lowest folders contain a file "image.png" which need to be converted to "folder.jpg". But how can I do that for all these files automatically? That's what I alredy have find /path -type f -name... (1 Reply)
Discussion started by: KarlKarpfen
1 Replies

2. Shell Programming and Scripting

Need a script for automation the convert a lot number audio files to another format

I have a lot number audio files in the MP3 proprietary format, I want to convert them to 'opus' the free and higher quality format, with keep metadata also. My selection command-line programs are SoX (Sound eXchange) for convert MP3 files to 'AIFF' format in order to keep quality and metadata*... (1 Reply)
Discussion started by: temp-usr
1 Replies

3. UNIX for Dummies Questions & Answers

Lot of warn files filling /

hi guys I have suse 11 sp1 and I have a lot of warn file filling / these are under /var/log there's this big one -rw-r----- 1 root root 3.9G Feb 1 10:28 warn warn: ASCII text and the others that are about 2.5 to 3MB - they are about 130 warn-*.bz2 -rw-r----- 1 root root 3.9G Feb... (2 Replies)
Discussion started by: karlochacon
2 Replies

4. Shell Programming and Scripting

Need to modify a lot of html files

Hello, I have about 3400 files in a tree structure (about 80% are html files). 1. I need to modify every html file to remove <p> style and old things like font attribute and add another style. 2. I need to change the root of all links that are in the html. e.g. change /old/path/ to /new/path... (1 Reply)
Discussion started by: Yaazkal
1 Replies

5. UNIX and Linux Applications

What is the difference between chmod in solaris and chmod in Linux?

i think it is the same in both... Iam i right? (1 Reply)
Discussion started by: sumaiya
1 Replies

6. Shell Programming and Scripting

Rename a lot of files using shells script

Hi This is the list file that i have : The files is more than this. I will rename one by one file become like this : So just change the time stamp 200906 become 200905. Is it possible using script ? Thanks (3 Replies)
Discussion started by: justbow
3 Replies

7. UNIX for Dummies Questions & Answers

Sorting with unique piping for a lot of files

Hi power user, if I have this file: file1.txt: 1111 1111 2222 2222 3333 3333 3333 4444 4444 4444 when I run the sort file1.txt | uniq > data1.txt the result is (2 Replies)
Discussion started by: anjas
2 Replies

8. Shell Programming and Scripting

help with chmod (files only)

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)
Discussion started by: TehOne
1 Replies

9. Shell Programming and Scripting

rename a lot of files again

here I go again...kinda hard to explain so I apologize. I need to rename a bunch of files in a directory. I need to remove the first three characters of the filename, and then toward the end of the filename there is constant text inside of brackets. here is a demo (not for real) 'ls -1' of the... (11 Replies)
Discussion started by: ajp7701
11 Replies

10. Shell Programming and Scripting

Problem comparing 2 files with lot of data

Hello everyone, here's the scenario I have two files, each one has around 1,300,000 lines and each line has a column (phone numbers). I have to get the phones that are in file1 but not in file2. I can get these phones trough Oracle but my boss does not want that so he gave me the files with the... (4 Replies)
Discussion started by: rafisha
4 Replies
Login or Register to Ask a Question