Hi.
How do I find files with no file extension?
For example, how do I find files such as shop-list as I want to rename it to shop-list.txt
I like to have all files with their appropriate file extension.
Hi.
How do I find files with no file extension?
For example, how do I find files such as shop-list as I want to rename it to shop-list.txt
I like to have all files with their appropriate file extension.
1st Distro used (live CD): Knoppix in early 2007 ¦ 1st Distro Installed: Ubuntu 7.10 in Feb 2008
GNU/Linux User #470660 – Ubuntu User #28226
Isaac Asimov: "I do not fear computers. I fear the lack of them."
have you tried this:
Code:mv ./shop-list ./shop-list.txt
---
Be paranoid. God is always building a better idiot.
1st Distro used (live CD): Knoppix in early 2007 ¦ 1st Distro Installed: Ubuntu 7.10 in Feb 2008
GNU/Linux User #470660 – Ubuntu User #28226
Isaac Asimov: "I do not fear computers. I fear the lack of them."
To list it for the current directory, maybe this is what you want:
find . -maxdepth 1 -type f ! -name "*.*"
To do it recursively, just remove "-maxdepth 1"
1st Distro used (live CD): Knoppix in early 2007 ¦ 1st Distro Installed: Ubuntu 7.10 in Feb 2008
GNU/Linux User #470660 – Ubuntu User #28226
Isaac Asimov: "I do not fear computers. I fear the lack of them."
I try to treat the cause, not the symptom. I avoid the terminal in instructions, unless it's easier or necessary. My instructions will work within the Ubuntu system, instead of breaking or subverting it. Those are the three guarantees to the helpee.
GPRename is my favourite.
1st Distro used (live CD): Knoppix in early 2007 ¦ 1st Distro Installed: Ubuntu 7.10 in Feb 2008
GNU/Linux User #470660 – Ubuntu User #28226
Isaac Asimov: "I do not fear computers. I fear the lack of them."
You can try this:
It will search all files that have no extension from test directory under your home directory and add .txt extension to all of those recursively.Code:find ~/test/ -type f ! -name "*.*" -exec rename -v 's/$/\.txt/' {} \;
This worked on my tests very well.
---
Be paranoid. God is always building a better idiot.
Excellent code, KeLa.
NOTE: Don't use this in home folder as it will rename hidden files and this will cause problems. Instead use in sub folders ONLY!
Last edited by Rytron; December 17th, 2009 at 04:18 PM.
1st Distro used (live CD): Knoppix in early 2007 ¦ 1st Distro Installed: Ubuntu 7.10 in Feb 2008
GNU/Linux User #470660 – Ubuntu User #28226
Isaac Asimov: "I do not fear computers. I fear the lack of them."
Bookmarks