11-20-2008
Finding files older than the current date and time and renaming and moving
Hi,
I have a very urgent requirement here. I have to find all files in the specified directory but not in the sub directories(The directory name is stored in a variable) which are older than the current date as well as current time and rename it as filename_yyyymmddhhmmss.ext and move it into a different folder(which is also stored in a variable). I am using solaris 5.8.
Here "yyyymmddhhmmss" refers to the date and time the corresponding file was created.
And when i try to use "stat filename" i get Ksh: not found error
Last edited by ragavhere; 11-20-2008 at 11:03 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a program that will export my data to a single file, but it assigns a file name that is overridden every time I run the program. I need to change the file name to have a sequential number in the filename.
How do I rename a file so that the filename contains the system date and time. I want... (5 Replies)
Discussion started by: wayneb
5 Replies
2. Shell Programming and Scripting
Greetings,
I know i can use the mv command to move and rename one file. How can I do this with multiple files?
example
pic01.bmp to pic0001.bmp
how can i perform this function on an entire directory of sequential files and keep them in sequence?
Hints, suggestions are most welcome:)
... (1 Reply)
Discussion started by: rocinante
1 Replies
3. Shell Programming and Scripting
HI,
I need to check whether the given file is 5 weeks older than current date ??
Can anyone give me the script for this ?? (1 Reply)
Discussion started by: risshanth
1 Replies
4. Shell Programming and Scripting
Hi,
I have a fixed 4 files in each different directory. The total 17 directories are there each one having 4 files inside it. I need rename all of them with current date. The files formates will be as below:
Folder1:
abc_NOR_xyz_ddmmyyyy.txt
abc_NOR_ghij_ddmmyyyy.txt
Folder2:... (5 Replies)
Discussion started by: rjanardhan83
5 Replies
5. Shell Programming and Scripting
I am a biologist and using an program on a computer cluster that generates a lot of data. The program creates a directory named
ExperimentX (where X is a number) that contains files "out.pdb" and "log.txt". I would like to create a script that renames the out.pdb file to out_ExperimentX.pdb (or... (1 Reply)
Discussion started by: yaledocker
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I want to add some hours and minutes to the current date. For example, if the current date is "July 16, 2012 15:20", i want to add 5 hours 30 minutes to "July 16, 2012 00:00" not to "July 16, 2012 15:20". Please help.
Thanks! (4 Replies)
Discussion started by: manojgarg
4 Replies
7. Shell Programming and Scripting
Hi Folks,
My server time is in EDT. And i am sending automated mails from that server in which i need to display the current date time as per IST (GMT+5:30). Please advice how to display the date time as per IST.
IST time leads 9:30 mins to EDT. and i wrote something like below.
... (6 Replies)
Discussion started by: Showdown
6 Replies
8. Shell Programming and Scripting
Hello,
i am trying to rename a folder named 'cpbackup' to current date in our WHM Root via setting up a cronetab entry. but the folder does not get renamed on the scheduled time :confused:
*/1 * * * * timestamp=$(date +%m%d%Y);/bin/mv /ac_backups/cpbackup /ac_backups/$timestamp (4 Replies)
Discussion started by: kandyjet
4 Replies
9. UNIX for Dummies Questions & Answers
I have a directory full of directories, say called A B C D E ....
In each of these directories there are files called 1.dsp 2.dsp 3.dsp ..... along with others (with different extensions)
I need to go through each of these directories and move the dsp file to another folder, but with the name now... (6 Replies)
Discussion started by: claire.a
6 Replies
10. UNIX for Beginners Questions & Answers
I have to display only those subscribers which are in "unconnected state" and the date is 90 days older than today's date.
Below command is used for this purpose:
cat vfsubscriber_20170817.csv | sed -e 's/^"//' -e '1d' | nawk -F '",' '{if ( (substr($11,2,4) == 2017) && ( substr($11,2,8) -lt... (1 Reply)
Discussion started by: dia
1 Replies
PACKF(1) [nmh-1.5] PACKF(1)
NAME
packf - pack messages in nmh folder into a single file
SYNOPSIS
packf [+folder] [msgs] [-file name] [-mbox] [-mmdf] [-version] [-help]
DESCRIPTION
Packf will pack copies of messages from a folder, into a single file.
If the -mbox switch is given (the default), then the messages are separated using mbox (uucp) style delimiters. This is the format used by
most mail clients (elm, mailx, etc.).
If the -mmdf switch is given, then the messages are separated by mmdf style delimiters. Each message in the file is separated by four
CTRL-A's and a newline.
You may specify the name of the file in which to use with the -file name switch. If you do not specify the name of the file, it will
default to "msgbox".
If the given file name points to an existing file, then the specified messages will be appended to the end of the file, otherwise the file
will be created and the messages appended.
packf makes an mbox-style delimiter by examining the first line of the message. If the first line is a "Return-Path" field, its address
and the current date and time are used. Otherwise, if the first line has an "X-Envelope-From" field, its contents (which should already be
in the correct format) are used. Otherwise, a dummy address and the current date and time are used.
Messages that are packed by packf can be unpacked using inc.
FILES
$HOME/.mh_profile The user profile
.msgbox.map A binary index of the file
PROFILE COMPONENTS
Path: To determine the user's nmh directory
Current-Folder: To find the default current folder
Msg-Protect: To set mode when creating a new `file'
SEE ALSO
inc(1), msh(1)
DEFAULTS
`+folder' defaults to the current folder
`msgs' defaults to all
`-mbox'
`-file ./msgbox'
CONTEXT
If a folder is given, it will become the current folder. The first message packed will become the current message.
MH.6.8 11 June 2012 PACKF(1)