Sponsored Content
Full Discussion: Renaming files
Top Forums Shell Programming and Scripting Renaming files Post 302785281 by anbu23 on Monday 25th of March 2013 07:44:36 AM
Old 03-25-2013
Code:
for file_nm in *
do
 ext=${file_nm##*.}
 mv $file_nm ${file_nm%_*}"_"$(date +%Y%m%d)"."${ext}
done

This User Gave Thanks to anbu23 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

renaming files

i have a set of *.lst files. now i want to change the names from "lst" to "dat". how to do it? ex.: -rw-r--r-- 1 rram group 22 Sep 21 13:10 a.lst -rw-r--r-- 1 rram group 22 Sep 21 13:09 b.lst -rw-r--r-- 1 rram group 22 Sep 21 13:10 c.lst... (4 Replies)
Discussion started by: raguramtgr
4 Replies

2. UNIX for Dummies Questions & Answers

renaming the files

Hi All, Today I got a small problem while handling zipped files in PROD support. There are files in this format and I had to grep them reading some contents A.B.gz.C.D where A,B,C and D stand for variables (like FIRST.NAME.gz.MIDDLE.LAST). I know that these files are zipped files and If I... (1 Reply)
Discussion started by: adurga
1 Replies

3. UNIX for Dummies Questions & Answers

renaming files

directory name = /usr/tom/1997 files - ABC_1997_ST1_BCD.SQL BCD_1997_ST1_EFG_SAB.SQL TTT_EBC_1997_ST1_A.SQL sub directory - /usr/tom/1997/jan a) I want to just rename the all files ending with '.SQL' and also its contents in the 1997 directory(excluding subdirectories eg... (3 Replies)
Discussion started by: systemsb
3 Replies

4. UNIX for Dummies Questions & Answers

Renaming files

Hello! I am not familiar with UNIX and I have this problem: I need to move files from a UNIX machine to a PC. UNIX file names contain ":" as special character which is not recognized in a PC. How can I change ":" for "_" in the name of a bunch of files in UNIX? Thanks for your help. (7 Replies)
Discussion started by: Tygoon
7 Replies

5. UNIX for Dummies Questions & Answers

renaming files

I have a list of files named ab_*.csv I would like to remane them all by removing the ab_ and have *.csv I did the following but I am surely missing something. /* wrong script */ for i in `ls -1 ab_*`; do mv ab_$i $i; done Thanks in advance. (1 Reply)
Discussion started by: jxh461
1 Replies

6. Shell Programming and Scripting

renaming files

Hi all, using a utility image file was named starting with blank space and a blank space in between. I want to rename the files. file names are in the format " sb 12.tif"," sb 13.tif"," sb 14.tif" the files are in thousands. i want to rename as 12.tif, 13.tif, 14.tif.... thanks. (3 Replies)
Discussion started by: ahkverma
3 Replies

7. Shell Programming and Scripting

renaming files or adding a name in the beginning of all files in a folder

Hi All I have a folder that contains hundreds of file with a names 3.msa 4.msa 21.msa 6.msa 345.msa 456.msa 98.msa ... ... ... I need rename each of this file by adding "core_" in the begiining of each file such as core_3.msa core_4.msa core_21.msa (4 Replies)
Discussion started by: Lucky Ali
4 Replies

8. Shell Programming and Scripting

renaming files

Hi, I have a list of files in a folder with the same name ending (over 1000 files) joe.jpy.jpeg joe1.jpy.jpeg joe2.jpy.jpeg jon3.jpy.jpeg jor5.jpy.jpeg .....jpy.jpeg etc. I want to change jpy to hhk So the output will be: joe.hhk.jpeg joe1.hhk.jpeg joe2.hhk.jpeg jon3.hhk.jpeg... (3 Replies)
Discussion started by: kylle345
3 Replies

9. Shell Programming and Scripting

Renaming files

Hi i have to achieve the following i have files as xyz001.csv, xyz002.csv.......xyz0025.csv in a folder, i need to keep xyz001.csv as it is but want to remove the extra zero on filename from 10 say xyz0010 should be renamed to xyz010 xyz0025 should be renamed as xyz025 Note xyz... (8 Replies)
Discussion started by: mad_man12
8 Replies

10. Shell Programming and Scripting

Renaming multiple files in sftp server in a get files script

Hi, In sftp script to get files, I have to rename all the files which I am picking. Rename command does not work here. Is there any way to do this? I am using #!/bin/ksh For eg: sftp user@host <<EOF cd /path get *.txt rename *.txt *.txt.done ... (7 Replies)
Discussion started by: jhilmil
7 Replies
GAMMU-SMSD-FILES(7)						       Gammu						       GAMMU-SMSD-FILES(7)

NAME
gammu-smsd-files - gammu-smsd(1) backend using filesystem as a message storage DESCRIPTION
FILES backend stores all data on a filesystem in folders defined by configuration (see gammu-smsdrc for description of configuration options). RECEIVING OF MESSAGES
Received messages are stored in a folder defined by configuration. The filename will be IN<date>_<time>_<serial>_<sender>_<sequence>.<ext>, for example NN20021130_021531_00_+45409000931640979_00.txt. Explanation of fields: <date> date in format YYYYMMDD <time> time in format HHMMSS <sender> sender number <serial> order of a message (in case more messages were received at same time), in format NN <sequence> part of the message for multipart messages, in format NN <ext> txt for text message, 8-bit messages are stored with bin extension, smsbackup for gammu-smsbackup The content of the file is content of the message and the format is defined by configuration directive InboxFormat (see gammu-smsdrc). TRANSMITTING OF MESSAGES
Transmitted messages are read from a folder defined by configuration. The filename should be one of the following formats: o OUT<recipient>.<ext> o OUT<priority>_<recipient>_<serial>.<ext> o OUT<priority><date>_<time>_<serial>_<recipient>_<note>.<ext> Explanation of fields: <recipient> recipient number where to send message <priority> an alphabetic character (A-Z) A = highest priority <ext> txt for normal text SMS, smsbackup for gammu-smsbackup <note> any artibrary text which is ignored For text messages, you can additionally append flags to extension: d delivery report requested f flash SMS b WAP bookmark as name,URL Other fields are same as for received messages. For example OUTG20040620_193810_123_+4512345678_xpq.txtdf is a flash text SMS requesting delivery reports. SMSes will be transmitted sequentially based on the file name. The contents of the file is the SMS to be transmitted (in Unicode or stan- dard character set). The contents of the file is the SMS to be transmitted (in Unicode or standard character set), for WAP bookmarks it is split on as Name,URL, for text messages whole file content is used. Please note that if file is not in Unicode, encoding is detected based on locales, which do not have to be configured if SMSD is running from init script. If this is your case, please add locales definition to init script. AUTHOR
Michal iha <michal@cihar.com> COPYRIGHT
2009-2012, Michal iha <michal@cihar.com> 1.31.90 February 24, 2012 GAMMU-SMSD-FILES(7)
All times are GMT -4. The time now is 12:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy