How to find all files which has names in uppercase in a directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to find all files which has names in uppercase in a directory
# 1  
Old 03-30-2012
Network How to find all files which has names in uppercase in a directory

i want to display all the files which has their names in the Uppercase in a particular directory...guide..
# 2  
Old 03-30-2012
List all files and reject any that have any lower-case chars.
Code:
ls | grep -v "[a-z]"

# 3  
Old 03-30-2012
Thanks for replying..but this didn't work for me..i have some files in a directory which are of two types like abc.IDS and XYZ.IDS , only the extension part is same. i want to display all the files of type XYZ.IDS
# 4  
Old 03-30-2012
In what way did it "not work"? Show exactly what you did, word for word, letter for letter, keystroke for keystroke, and show exactly what happened afterwards.

It works fine here:

Code:
$ mkdir mytest ; cd mytest
$ touch abc.IDS XYZ.IDS
$ ls | grep -v "[a-z]"
XYZ.IDS

$

# 5  
Old 03-30-2012
Okay! it worked..but when i am doing ls -l | grep -v "[a-z]", it is showing nothing. the ls | grep -v "[a-z]" is working fine..thanks 4 help
# 6  
Old 03-30-2012
That is because ls -l shows a lot more than just file names, and it ends up finding lowercase letters in other parts.

If you wanted to filter ls -l's output, you need a tool that understands columns, like awk:

Code:
# Print all lines where the last column does NOT contain lowercase letters
ls -l | awk '!($NF ~ /[a-z]/)'

...but this won't work for filenames with spaces.
# 7  
Old 03-30-2012
it worked, Thanks for Great help!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , ... ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

2. Shell Programming and Scripting

Edit names of files in a directory

Hi all, I have a directory with multiple (thousnads) of files, which are named this way ABCDEF.wo.im-1 OKRAME.ire.roi IOJEAFO01.irt.gfg IMNYBL05.REG.gkf I would like to keep the part of the name (everything before the first dot in the filename). The desired output: ABCDEF... (3 Replies)
Discussion started by: Error404
3 Replies

3. Shell Programming and Scripting

making find/sed to include directory names with spaces

how can i make find/sed to include directory names with spaces the command is like this for i in `find wp-content/themes -type f -print0 | xargs -0 grep -l -iE 'e'`;do sed -i -e 's/word1/word2/gI' "$i";done but it skips one directory names with spaces sed: can't read ./Nova: No such... (5 Replies)
Discussion started by: vanessafan99
5 Replies

4. Shell Programming and Scripting

Find Files and then convert them to Uppercase

Hi All, So I'm new to scripting and I've been put in a position to convert a bunch of files with specific extensions in a folder and all its subfolders to uppercase including their extension. I figure so far I could do something like this: ... ... and then input $line into another bash... (12 Replies)
Discussion started by: ideal2545
12 Replies

5. Shell Programming and Scripting

How to find empty files in a directory and write their file names in a text?

I need to find empty files in a directory and write them into a text file. Directory will contain old files as well, i need to get the empty files for the last one hour only. (1 Reply)
Discussion started by: vel4ever
1 Replies

6. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

7. UNIX for Dummies Questions & Answers

find the file names having specified pattern at specified position in the current directory

I would need a command for finding first 15000 of the file names whose 25th postion is 5 in the current directory alone. I do have this painful command find . -name '5*' | head -15000 | cut -c3- please refine this. Of course the above command also searches in the sub directories... (3 Replies)
Discussion started by: vk39221
3 Replies

8. Shell Programming and Scripting

Find Directory from array of file names with paths

I have a script that generates a variable with the location of a file and its complete path. What i want to do is to "cd" to the directory where that file is located using the path name of the file. GIS has absolutely failed me. For example when i run my script it generates a variable called... (1 Reply)
Discussion started by: Knome
1 Replies

9. UNIX for Dummies Questions & Answers

WebDav/davfs mounted file & directory names in all UPPERCASE

Hey, I have a WebDav directory mounted and everything seems fine except for one thing. All file/directory names appear in all UPPERCASE, when in actual fact they are lowercase on the remote machine. For example: foo/bar/baz.html on the remote host, appears on my local machine as... (0 Replies)
Discussion started by: MrMoney
0 Replies

10. Shell Programming and Scripting

find the length of file names in a directory?

Hi, how can find length of file names in a directory. Examp: I have a directory with name "d1". directory: d1 files: aaa.log bbb.log abcd.log abcdef.log I wold like out put like: file name legnth aaa.log 3 bbb.log 3 abcd.log 4 abcdef.log 5 (5 Replies)
Discussion started by: koti_rama
5 Replies
Login or Register to Ask a Question