Programming :: Date In The File Name(cron)?

Mar 12, 2011

I tried to write a cron job in Fedora13 as follows

#!/bin/bash
today='date +%d%m%Y'
cp /var/www/html/site1/module.txt /home/amitha/Desktop/backup/$today.module.txt

[code]....

View 3 Replies


ADVERTISEMENT

Programming :: Keep Original Mod Date Of A File And 'date' It Back To Same File?

Jul 12, 2010

I would really like to preserve a file's original modified date and pass it back to the file as the same attribute after a script has worked on it. I get a lot of JPEG files from different places on the Net which I either turn around and upload or burn to disk, and having the "original" date of either download or last mod in a graphics app would be for me, in the long run, a lot more helpful when deciding, for instance, which files to "recycle" or pass on backing up more than once.I've tried doing this on my own every now and then. Where I run into problems is that it appears "stat" and "date" use different formats for date information, and I can't seem to puzzle out how to "translate" one to the other satisfactorily for the latter command.

Just to give an example:
stat foo.jpg |grep Modify gives me
Modify: 2010-07-12 06:28:56.890625000 -0400

Passing that string as-is to date foo.jpg, I get the errordate: unknown option -- 0 and the usual semi-courteous suggestion to Try 'date --help' for more information.Somehow my TexInfo database got screwed up somewhere along the line and info dategives me the short article on date input formats, not the full documentation for the command

View 4 Replies View Related

Programming :: Concatenate File Sort By Date?

May 5, 2010

i have text file that filename contain the date of creation (i.e 2010.05.02.log).I would like to create a script that:-Ask for start date -Ask for end date- Concatenate all file on the requested period by date order.

View 1 Replies View Related

Programming :: Script To Find Out Modified Date For Particular File

Jul 9, 2010

I am new to Scripting. I am trying to find out particular file is modified in last one hour or not in script and then if that file is modified in last one hour i need to copy that file to another directory.Can any one please provide me how to check the file is modified in one hour or not?

View 3 Replies View Related

Programming :: Bash Scripting With File Date Comparison?

Mar 23, 2011

I need to be able to compare a file date with system date and delete files older than 30 days.

the file name is basically
error_log.03222011

of course the extension is the date the file was created.

Oh and before i get hammered I looked everywhere but am unable to make sense of what I found.

View 3 Replies View Related

Programming :: Converting Epoch In A File Name To Human Readable Date/time?

May 5, 2011

I have log files that everyday are downloaded from my webserver in the format: Code: samplesite.com.xxxxxxxxxxx.gz xxxxxxxxxx is a 10 digit epoch time. I am trying to figure out a way in batch to:

1. find all of exisiting files containing the pattern (after the first run it will only be one a day)
2. Isolate the epoch string
3. convert the epoch string to human readable date/time
4. rename the original file as samplesite.com.mmddYYYY.gz

View 2 Replies View Related

Programming :: Bash Script To Copy Modification Date From A File To His Folder?

Jul 29, 2011

I need this script but I don't know how to do it I have one folder with several folders inside.On each folder a have one MKV or AVI file inside...What I need is a script to change the "modification date" of each folder to the "modification date" of each MKV or AVI that the folder has inside.

View 16 Replies View Related

General :: Log The Start/completion - Time&date - Of My Cron Job Script?

Jan 11, 2010

How do i log the start/completion (time&date) of my cron job script? i want to be able to see what time it started and what time it finished? and if there where any errors while running my script.

View 3 Replies View Related

General :: Use Date With Touch To Create New File With Date Based Name?

Mar 12, 2010

I am using CRON to create a new, blank file, every minute, in a specific location on my web server. After web searching, and reading man pages, I get the impression that the following command is supposed to work:touch /home/mydomain/var/folder/attachments/`date +%H%M`.txtThis should give me a new file with a file name that is the current hour and minute.However, when executed, the CRON mailer reports:touch /home/mydomain/var/folder/attachments/`date +/bin/sh: -c: line 0: unexpected EOF while looking for matching /bin/sh: -c: line 1: syntax error: unexpected end of fileSo, it looks like shell is seeing the plus (+) sign as an EOFObviously, nothing get created.What would be the easiest, single line command to create an empty file, at a given location, with a time based file name

View 5 Replies View Related

Programming :: Writing Unix Shell Script To Pass File Name/path/creation Date?

Oct 7, 2009

I'm new to UNIX scripting; I�m stuck with the following I have an Oracle SQL script that takes three parameters

1- File Name
2- File Path
3- File creation date

Under UNIX I have a folder where files will be placed frequently and I need to upload those files to Oracle, what I need is a UNIX script that can do the following

Loop through Directory "/home/applmgr/snktmp"
Picks only files
Pass the file name to parameter &1

[code]....

Is the above possible? I already knows how to call the Oracle Script from UNIX Im only stuck on writing the UNIX part where it List the files attribute(name,path,date) and store them to parameters ,Looping until the last file in the directory If the above is not possible,then how can I create the below from the command line

Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate
Filename{concatenation Mark}filePath{concatenation Mark}creationdate

View 4 Replies View Related

Ubuntu Multimedia :: Digikam - Renaming On Import - "Create Date" Versus "File Modification Date"

Jan 24, 2011

I just switched from a basic digital camera to a more advanced one that stores both Jpeg and Raw (.Nef - it's a Nikon) files for me.When importing files in Digikam, I rename the files so that they start with Date and Time. Example: 20110121-223748.JPG for a photo taken on Jan 21st 2011 at 22:37:48.I was a bit surprised when importing both the JPEG and the Raw version of the same photo, that the filename is different by a few seconds (no constant offset, sometimes they are the same):

20110121-223748.JPG
20110121-223750.NEF

I did some "research" by looking at the exif data of both files (using "exiftool 20110121-223748.JPG" from the command line). Here is what I got back

(amongst other data):20110121-223748.JPG
File Modification Date/Time : 2011:01:21 22:37:48+01:00
Modify Date : 2011:01:21 22:37:48
Date/Time Original : 2011:01:21 22:37:48

[code]....

So it seems that Digikam is using the "File Modification Date/Time" (different in the Jpeg's and Raw's of my camera) rather than the "Create Date" (the same for both Jpeg and Raw). (The few seconds difference in "File Modification Date/Time" between the two versions of the same photo is probably due to the time that my camera needs to write away the data on the SD memory card. I guess.) Is there a way to have Digikam use the Create Date? (Or the Date/Time Original?)

PS: I'm on Ubuntu 10.04LTS, using DigiKam 1.2.0

View 1 Replies View Related

General :: Parsing File Dates - Get The Date Of The Last Time A File Was Modified ?

Jan 11, 2010

I need to get the modified date on a file in linux to use in a script.I tried using 'ls -l' on the file, but this caused problems when the date turned from a single digit into a double. The reason for the problem was because I was parsing the result string on spaces.How can I get the date of the last time a file was modified so I can use it in a script? For example, if a file was modified on 1/11/2010, I need the 11.

View 2 Replies View Related

Programming :: Print Everything After $date?

Feb 21, 2010

Say I have a line like such:

Code:
today 2010 Feb 21 test10, 12AM

How would I print everything AFTER "2010 Feb 21 "?

What I thought to do so far is to set a variable to the format used in the string like so:

Code:
date="$(date +%Y %b %e)"

So I know I have to use either awk, sed, or perhaps bash substrings to work with the variable $date, but as to how, I'm drawing a blank.

View 5 Replies View Related

Programming :: Date Listing In Perl?

Jun 1, 2010

Using given program , i am able to print current date but is is possible to print last n no. of date. For example i want to print last three date staring from today. so o/p should be like

2010-06-02
2010-06-01
2010-05-31
Code:
my $myTimeStamp = "";
sub _timestamp
{

[Code]...

View 1 Replies View Related

Programming :: Date Subtraction Using Numbers

Nov 15, 2010

I want the get the date of the oldest log in this directory and compare it with current date.Time of the each log can be seen before ".Z" prefix.I have written the following piece of code. However, it is not working for the following case:

LOGDAY=20101129
TODAY= 20101201

Difference is 72, which is not correct, since these are dates.

View 11 Replies View Related

Programming :: Get Date From System In C Language?

Aug 15, 2010

How can i get date from system in c language

View 4 Replies View Related

Programming :: Script Didn't Run In Cron ?

Sep 24, 2010

I have a script put in cron.daily and edit the var/spool/cron/crontabs/root file with this text

Code:

View 1 Replies View Related

Programming :: BASH Add Cron Job To Run Hourly

Mar 25, 2010

I have an rsync script I wrote that I have tested and it works perfectly when I run it manually. Now I am working on a server setup script and I have gotten my setup script to create the rsync script in /etc/cron.hourly and restart crond. To spite the fact that the script is in /etc/cron.hourly and I have restarted crond, the script does not run. With that said, how can I script adding the rsync script to run hourly as a cron job?

View 9 Replies View Related

Programming :: Cron Job Not Running / Sort It?

Aug 25, 2010

I am executing the script.

with help of cron job but it is not executing in cron job.

i check owner and chmod and create the file and execute manually it is working fine but in cron job i set below

Crontab -e

8 14 * * * /home/tplinux/webapp/tpadminhost/collect_ejxml/ejrename.sh

wq!

after that wait till that time but script is giving message no such file in directory but same thing is excute manually it is running fine and found the files.
Below is my script details
file name ejrename.sh. code...

View 3 Replies View Related

Programming :: Date Formatting From Stat Command?

Jul 23, 2010

I'm writing a script that takes the date attribute of a file when it was created and appending it to the name. I'm pretty close to what I need, but the date appears in yyyy-mm-dd format and I want it to read mm-dd-yyyy. What I have done so far is something like

for ((i=1;i<=50;i++));
do fdate=`stat -c %y Video Snapshot $i.png|awk {'print$1'}`;
newname=Personname-$fdate-$i.png;
mv Video Snapshot $i.png $newname;
done

This works decently but the date comes out in the yyyy-mm-dd format. How do I change it?

View 10 Replies View Related

Programming :: Add Date/Time To The Message Body?

Sep 6, 2009

- how to add the date/time to the email (message body)

- how to as the user to add a picture

- how add on an error page a button to send it back to the form so that the input does not get lost

Here the program so far:

<?php
/*
CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.15.0
Generated by thesitewizard.com's Feedback Form Wizard 2.15.0.

[code]....

View 1 Replies View Related

Programming :: Ls -R Without Changing Access Time/date?

Aug 31, 2010

I am using cygwin in order to test a bash script that uses the ls -R command. When I use this, the access date of the subfolders are changed, and I need them to remain what they were before the command was run. I don't have access to a legitimate Linux system, so I'm not sure if this is the fault of cygwin or the ls command. The script is being used to find the last access date of all files underneath several subfolders and then return the latest date found in each subfolder as the last access date for that subfolder. For some reason, some of these folders have files in them that are newer than the folder's last access date, so the script is meant to give us a list of the true last access date for these folders.

View 5 Replies View Related

Programming :: Searching Recursively By Exif Date?

Feb 20, 2010

I have searched diligently but can't seem to find a way to search by exif date. Most of my searches turned up commands to manipulate EXIF data not just search by it. I have found some likely tools but suspect that I don't know enough bash to recursively find a .jpg file by it's exif date. For example, exiprobe and exifgrep look promising (see examples below).

I have made some progress. At first, I couldn't associate the file name with the date given but learned that the "n" option forces each output line to start with the file name. Now, I need to make the command recurse but can't seem to manage it.
halloween_IMG_0965.JPG: JPEG.APP1.Ifd0.Exif.DateTimeOriginal = '2009:10:31 20:58:52
If it helps, I have linked to the man pages [URL]

View 6 Replies View Related

Programming :: Use CRON To Create New User Accounts?

Aug 17, 2010

Can we use CRON to create new user accounts?

View 4 Replies View Related

Programming :: Running Shell Script Using Cron Job

Jul 8, 2011

I am using Shell Script to run my Java program. I have written a Cron job to invoke Shell Script every day at 7pm. Cron job is running every day at 7pm ,but it is not invoking my shellscript and also I am not getting any error message. I am able to run same shell script from cmd propmt using bash, and also I am able to invoke the same script from mainframes Universal command job. Same ShellScript and Same cronjob is working fine in my Dev server. But in my QA server it is not working.

View 7 Replies View Related

General :: Put The Date In The Name Of File But Can't Seem To Get?

Apr 11, 2011

I'm trying to put the date in the name of my file but cant seem to get it I just end up with the word date in the file instead of the date. my script looks like this.

#!/bin/bash
x="/var/log/system/"
y=date
z=${y:11:8}
top > $x$y.txt

View 3 Replies View Related

Debian Programming :: Yesterday Date In Bash Script

Jun 22, 2011

I have used "FILENAME="`TZ=$TZ+24 date +%y%m%d`" in a bash script that run in openbsd. What my script does is to changes a file name to "yesterdays date". I tried to use it in a script that runs in debian but it doesnt work. Is there any other command that i can use in debian?

View 3 Replies View Related

Programming :: Get Script To Delete Files If They Are Certian Date?

Feb 21, 2011

the moment the file name goes as backup-"$(date +%d-%b-%y)" so something like backup-13-Feb-11.I have already setup in my script to make sure the backup was successful and is not corrupt what I need to do next if for exampleif I backup for 21st feburarybackup-21-Feb-11if it finds anything older than five days for examplebackup-13-Feb-11 it will delete this. I want the old delete part to work on the filename not a system time stamp

View 7 Replies View Related

Programming :: Make Date Of Birth Form In Html

Jun 2, 2011

How to make Date of Birth form in html....in short codes.....?

View 1 Replies View Related

Programming :: Converting YYYYMMDD To Date In Bash Script?

Aug 2, 2010

I need to convert strings in the format YYYYMMDD to dates so I can perform date arithmetic.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved