Paramater list too long while chmod


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Paramater list too long while chmod
# 1  
Old 07-17-2009
Paramater list too long while chmod

Hi i am transferring the files(around 10000) from the Windows sever to the UNIX server in that i run a command chmod 777 filename.txt
but it is taking a longer time as it gives chmod for each and every file.
So i thouught of giving the permission from the UNIX itself and i tried running
chmod 777 filename.txt and it is throwing an error Parameter list is too long.
So i tried it with find . -name "filename*.txt" -exec chmod 777 {} \;

still i get the error parameter list is too long!
Any other options to avoid this error wud be highly appreciated!
Thanks in advance!
# 2  
Old 07-17-2009
See if this works. Make sure you are in the required directory.


Code:
 
ls filename*.txt | xargs chmod 777

# 3  
Old 07-17-2009
I hope even
Code:
ls filename*.txt | xargs chmod 777

would fail paramater list too long as it tries to expand filename*.txt for ls.

I think the following command would work:

Code:
ls -1|grep \\.txt$|xargs chmod 777

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Argument list too long

Hi Team, Here's the situation. I have approximately 300000 to 500000 jpg files in /appl/abcd/work_dir mv /appl/abcd/work_dir /appl/abcd/process_dir The above move command will work if the jpg files count is close to 50000 (not sure). If the count is less this mv command holds good. But if... (14 Replies)
Discussion started by: kmanivan82
14 Replies

2. UNIX for Dummies Questions & Answers

Arg list too long

Hello All, I am trying to find a file name with .sh exention from a list of .dat files inside a directory. find /app/folder1/* -name '*.dat'| xargs grep '.sh' ksh: /usr/local/bin/find: arg list too long Please help me finding the command. Thanks (3 Replies)
Discussion started by: tkhan9
3 Replies

3. Shell Programming and Scripting

Chmod list of files

Hi, I have a list of files in a text file. I want to change the mode of every one of those files, but am having difficulty in doing so. #!/bin/bash files=/home/david/files.txt for $item in $files { chmod 640 $item } .. doesn't cut it. Can anyone help? Thanks. (7 Replies)
Discussion started by: davidm123SED
7 Replies

4. Shell Programming and Scripting

Argument list too long!!

Dear Experts, I have a list of 10K files in a directory. I am not able to execute any commands lile ls -lrt, awk, sed, mv, etc........ I wanna execute below command and get the output. How can I achieve it?? Pls help. root# awk -F'|' '$1 == 1' file_20120710* | wc -l /bin/awk: Argument list... (2 Replies)
Discussion started by: Naga06
2 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. UNIX for Dummies Questions & Answers

-r paramater with chown and rmdir

If I am root user, and trying to chown everything in a directory and it's subdirectories (e.g. httpdocs and everything inside that directory, including it's sub directories), how would I do that? I tried it with -r but it didnt seem to work...can someone help with the correct syntax? Also, if I... (3 Replies)
Discussion started by: Eman619
3 Replies

7. Shell Programming and Scripting

parameter list too long

This is one of shell things I guess. I have a directory in a production server that contains about 20,000 files. It gets cleaned up every week and is kept in check that it does not get out of hand. Here is my problem. When I perform a ls -ltr, I get the listing. However should I parameterize... (4 Replies)
Discussion started by: jerardfjay
4 Replies

8. UNIX for Dummies Questions & Answers

ls -t arg list too long

echo dirname/filename* | xargs ls -t As a substitute doesn't give the results desired when I exceed the buffer size. I still want the files listed in chronological order, unfortunately xargs releases the names piecemeal...does anyone have any ideas? :( (4 Replies)
Discussion started by: CSU_Ram
4 Replies

9. Shell Programming and Scripting

Cp All But Some Files, paramater for cp command?

I'm creating a shell script, part of which has a cp command.So far i've got: cp --recursive --reply=yes /development/myProgram/* /somewhere/else I need to add something that says to not copy certain files, in this case all directories named "CVS" and files named ".project" and... (2 Replies)
Discussion started by: allelopath
2 Replies

10. UNIX for Dummies Questions & Answers

arg list too long

I do ls -l ABC*, I get arg list too long message. This will not happen if ABC* has small no of files I believe 4000 files is limit. Any way of avoiding this. I even tried like this for i in `ls -l ABC*` do echo $i done Same problem. Any solution would be great. I am on HP-UX... (5 Replies)
Discussion started by: vingupta
5 Replies
Login or Register to Ask a Question