add a extention to all files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting add a extention to all files
# 1  
Old 10-05-2011
add a extention to all files

I'm working on implementing a mail indexer and it currently saves every file with a series of numbers with no extension. ex. 021545545544

I was wondering if someone could point me in the correct direction for a script that would check all the files and give it a .eml extension if it doesn't already have one.


Code:
find /home/administrator/Maildir/test -type f -exec mv '{}' '{}'.eml \;

So far this is what I have but id like it to not add the eml extension if it already has one.
# 2  
Old 10-05-2011
Code:
find /home/administrator/Maildir/test -type f ! -name '*.eml' -exec mv '{}' '{}'.eml \;

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find -ctime -1 cannot find files without extention

The problem is this one. I tar and gzip files on remote server find . -ctime -1 | tar -cvf transfer_dmz_start_daily.tar *${Today}*.*; Command find . -ctime -1 Doesn't find files without extension .csv .txt I have to collect all files for current day, when the program... (1 Reply)
Discussion started by: digioleg54
1 Replies

2. Shell Programming and Scripting

find -ctime -1 cannot find files without extention

The problem is this one. I tar and gzip files on remote server Code: find . -ctime -1 | tar -cvf transfer_dmz_start_daily.tar *${Today}*.*; Command Code: find . -ctime -1 Doesn't find files without extension Code: .csv .txt I have to collect all files for current... (1 Reply)
Discussion started by: digioleg54
1 Replies

3. Shell Programming and Scripting

sed to remove all lines in file that are not .vcf.gz extention

I am trying to use sed to remove all lines in a file that are nor vcf.gz. The sed below runs but returns all the files with vcf.gz in them, rather then just the ones that end in only that extention. Thank you :). file ... (9 Replies)
Discussion started by: cmccabe
9 Replies

4. Shell Programming and Scripting

How to find complete file names in UNIX if i know only extention of file

Suppose I have a file which contains other file names with some extention . text file containt gdsds sd8ef g/f/temp_temp.sum yyeta t/unix.sum ghfp hrwer h/y/test.text.dat if then.... I want to get the complete file names, like for above file I should get output as temp_temp.sum... (4 Replies)
Discussion started by: panchal
4 Replies

5. UNIX for Dummies Questions & Answers

problem with packages that have .tar.gz in the extention

Hi Everybody , I want to install some packages on sun Solaris , I download the packages it was for example openssl.tar.gz it is not data stream or sun packages , so I search and I found command called make solve this problem , but the packages of this command not found on my machine, so I... (7 Replies)
Discussion started by: hard_revenge
7 Replies

6. Shell Programming and Scripting

Listing files in a given directory with given extention

for some reason my code does not give the right number of files. can omeone help me please? (2 Replies)
Discussion started by: andrew1400
2 Replies

7. Shell Programming and Scripting

Add extention to files recursively.

I want to add a .txt extension to all files in a directory and it's sub directories. So far I have managed to come up with this for the current directory but how do I do this recursively? for e in *; do mv "$e" "`echo $e | sed -e 's/\ /_/g'`.txt"; done Thanks (5 Replies)
Discussion started by: lewk
5 Replies

8. Shell Programming and Scripting

changing file name not the file extention

Hello experts, I need to solve the problem stated below: 1.have to search for " operator.java" file and rename it to as OPERATOR.java 2.Also I have to change the following line inside the file: public class operator----->public class OPERATOR the only thing that i can think is... (2 Replies)
Discussion started by: mlhazan
2 Replies

9. UNIX for Advanced & Expert Users

Search files with specfic extention and later search content

Hi, I would appriciate if somebody can help me figure out how to search for all the *.xml file under a specific directory and subdirectroies (/home/username) and later search of content "<start>" inside the xml file returned by search. -Lovin.V (2 Replies)
Discussion started by: lovi_v
2 Replies

10. Shell Programming and Scripting

Strip extention from filename

Hey, How to strip the extention from filename? MY_XML.xml -> MY_XML MY_TEST_FILE.txt -> MY_TEST_FILE HELLO_WORLD.xls -> HELLO_WORLD Thanks in advance! (2 Replies)
Discussion started by: mpang_
2 Replies
Login or Register to Ask a Question