04-09-2010
append file name with date
Hi guys,
I created a very basic script that moves a specified file to a directory that I have set using the mv command. What I would like to do is append the file name with the date and time.
So if I was to use the script to move a file called abc.txt, the script should rename the file abc.txt.DDMMYY.HHMMSS. The time and date should obviously be todays date and the time.
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Can anyone plz share their experience with -
Building shell script to append the file with date in following format-
Filename_MMDDYYYY.txt
Thanks in advance (2 Replies)
Discussion started by: prince_of_focus
2 Replies
2. Shell Programming and Scripting
Hi,
I am trying to append date in DAY_Mon_dd_yyyy at the end of a filename from cron.
Cron entry looks as below.
(script to execute) > test_file_`date +"a_%b_%d_%Y"`
File name created after executing the job is test_file_
I am expecting the filename to be something like ... (8 Replies)
Discussion started by: dncs
8 Replies
3. Shell Programming and Scripting
Hi
I need to append date to filename.Wrote script to get the date from table ,take this date filed and append to my i/p file when call the below script.Any help should be appreciated .
Exampel
If call the below script
a4.sh filename
o/p should be
filename.2008-02-29
.... (6 Replies)
Discussion started by: mohan705
6 Replies
4. Solaris
I want to gzip a file and append the creation date to the end of the file. How can I accomplish this task. Basically they are log files which need a creation date stamp appended to make sure they do not overwrite other log files.
-jack (3 Replies)
Discussion started by: jacktravine
3 Replies
5. Solaris
Hello All,
What I would like to do is search for a file and then run a mv command to rename the file to have todays date appended to it. The find when I run it finds eight or so files and I would like to append a date stamp to each file. If possible using one line command would be great. Can... (6 Replies)
Discussion started by: jacktravine
6 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I am a novice user on an AIX 5.3 system.
I am running some scripts via crontab and redirecting the output to a file.
For example: /home/cognos/ppdev_refresh.sh > /home/cognos/ppdev_refresh.txt
I want to append the system date to the file name so it becomes:... (7 Replies)
Discussion started by: Maurice Frank
7 Replies
7. Shell Programming and Scripting
To delete log files content older than 30 days and append the lastest date log file date in the respective logs
I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs
This is my script
cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies
8. Shell Programming and Scripting
I was thinking something like
for i in `find . -name "*.log.Z"`; do mv $i name.log.Z
or something like that? (3 Replies)
Discussion started by: xgringo
3 Replies
9. Shell Programming and Scripting
Trying to process 1000 or so files. Take original date and append to end of file. Like so:
tstpls42.bas
tstpls42.bas.Sep-11--2011
Been working along these lines:
date=`ll tstpls42.bas |cut -c 46-57 |sed -e 's/]/\-/g' | grep -v '^$'`
for i in *.bas ; do j=`ll $i /hpdump/b1 | awk... (1 Reply)
Discussion started by: joeadmin
1 Replies
10. Shell Programming and Scripting
SQL*Plus version : 11.2.0.4
OS : Oracle Linux 6.5
SQL*Plus is a client application to connect to oracle database. The log file for this tool is generated via spool command as shown below.
I am trying to append date ( $dateString ) to spool file as shown below.
$ cat test2.sh
#!/bin/bash... (4 Replies)
Discussion started by: kraljic
4 Replies
LEARN ABOUT DEBIAN
gammu-smsd-files
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)