LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-22-2012, 12:05 PM   #1
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Rep: Reputation: 64
Question about creating files, and upper and lower case letters


What is the programme that writes files on to the hard drive? and then writes the filename to creates the inodes (?)



To give an example, say Im downloading a file called 'Match Of The Day.avi. Is there an option to the programme that is handling the writing of the file to the hard drive to write all the letters in the filename to lower-case?
 
Old 08-22-2012, 12:57 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Your first question ultimately refers to system calls and filesystem operations. Not going to speak to that, when I think your real (much simpler) question is:

Quote:
Originally Posted by clifford227
To give an example, say Im downloading a file called 'Match Of The Day.avi. Is there an option to the programme that is handling the writing of the file to the hard drive to write all the letters in the filename to lower-case?
It depends on the program you're using to download the file. If you're using wget(1), for instance, there is an -O (that's a capital "o") option that can be used like so:

Code:
$ wget -O good-sneaky-name.html 'http://google.com/index.html'
 
1 members found this post helpful.
Old 08-22-2012, 01:00 PM   #3
guyonearth
Member
 
Registered: Jun 2012
Location: USA
Distribution: Ubuntu
Posts: 424

Rep: Reputation: 83
You can name a downloaded file anything you want.
 
Old 08-22-2012, 01:02 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
@clifford227: At second read, I think you're actually asking whether you can keep the name, but convert it to lower case. I can only think of contrived scripting methods for doing so. Don't know of any tidy program option.

wget(1)'s --restrict-file-names may be promising, but I've never tested it.
 
3 members found this post helpful.
Old 08-22-2012, 04:25 PM   #5
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
First let me apologise for this late reply.

I dont have my desktop system up and running yet (Im waiting for Slack 14), and in the meantime I am having to borrow a laptop from someone else.

Unfortunatley, almost immediately after creating this thread, I had to give the laptop back, and I am only now able to reply.

Quote:
Originally Posted by anomie View Post
@clifford227: At second read, I think you're actually asking whether you can keep the name, but convert it to lower case.
Yes, thats correct.

The reason I wanted to do that was because I was having problems with the 'find' command, which has been driving me up the wall.

I have now stumbled upon a partial solution, the ls and grep commands which I then use in an alias:

Code:
alias search='ls | grep -i'
When given a search word in either upper or lower case, the alias returns both upper and lower case matches.

Last edited by clifford227; 08-22-2012 at 04:31 PM.
 
Old 08-22-2012, 04:44 PM   #6
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
If you use find with the -iname option instead of the -name option you have the same effect: a case-insensitive search.
 
Old 08-22-2012, 06:22 PM   #7
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
Quote:
Originally Posted by TobiSGD View Post
If you use find with the -iname option instead of the -name option you have the same effect: a case-insensitive search.
I did try the -iname option, but I was getting some strange results.

(Although it is possible that I wasnt using the find command properly. I had a hard time following the man page.)

If I remember, if there was only one file with a name containing a search word, find would find it and print it to the screen, but if there were two files that contained the search word, find wouldnt list either, or it would only find a case-sensitive match (I cant quite remember exactly, but find wasnt giving me the results I expected).

Last edited by clifford227; 08-22-2012 at 06:27 PM.
 
Old 08-22-2012, 06:27 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,397

Rep: Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777
find with case IN-sensitive search
Code:
find /somedir -iname '*.dat' -print
It really does work as TobiSGD said
 
Old 08-22-2012, 06:40 PM   #9
clifford227
Member
 
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Original Poster
Rep: Reputation: 64
Chris,

I'll take another look at find tomorrow, and see if I can reproduce the problem.
 
Old 08-23-2012, 02:18 AM   #10
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797

Rep: Reputation: 282Reputation: 282Reputation: 282
The 'iname' option is not always available; depends on the implementation of 'find' in the distro. I ran into that problem last night while using DSL. And the error message in this case left a lot to be desired
 
Old 08-23-2012, 05:02 AM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by Wim Sturkenboom View Post
The 'iname' option is not always available; depends on the implementation of 'find' in the distro. I ran into that problem last night while using DSL. And the error message in this case left a lot to be desired
That is because DSL uses the find program that is inbuilt to Busybox, for space reasons. Most Busybox versions of commands come with a reduced feature set, otherwise they would take the same space as the GNU and BSD versions.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File extension and upper and lower case in .text files thepowerofone Linux - Newbie 9 11-25-2011 11:47 AM
mkisofs -iso-level 1 converts to lower case instead of upper case. stf92 Slackware 3 10-29-2010 12:32 AM
renaming directories from upper case to lower case, help!! linux_teller Linux - Newbie 3 03-07-2008 05:15 AM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 04:09 PM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 04:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration