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


ADVERTISEMENT

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 :: 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 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

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

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

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

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

General :: Stripping EXIF Metadata + Preserving Of The Original Date

Feb 23, 2011

I would like to remove almost all of the Privacy Evading data that a digital camera is generating, such as EXIF DATA. EXIF DATA: Camera Brand, Camera Model, Date taken, Exposure Time, Flash Fired, Focal Length, Location (if you are using iPhone with categorization by location, if enabled), Metering Mode, etc.

May you, please, write a script which does that job for multiple files?Exiv2 seem to reduce more weight than Jhead so I'll use the command exiv2.That's, generally, what I want the script to do:Retrieve the (Modified) date of a file.

View 3 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

General :: Maximum Date Value From A File?

May 10, 2011

I am facing a problem in finding out the maximum value of a field using awk .. The field is of date format i.e. (MM/DD/YYYY) ..

The contents of the file is :

2/2/2011 XYZ
2/2/2011 XYZ1
2/3/2011 ABC
2/4/2011 ABC

[Code]....

I need to find the maximum of the first column i.e. my output should be 2/12/2011 ..

I was using the below awk script : awk 'n < $0 {n=$0} {print n}{print $0}' <source_file having the above data>

But the output I am getting is 2/9/2011 instead of 2/12/2011 ...

what could be reason for this output and how can I get my desired result ..?

View 3 Replies View Related

CentOS 5 :: Get File Date On Other Server?

Aug 16, 2011

Is it possible to get the last modified date for one file on a remote server from command line?

View 4 Replies View Related

Ubuntu Multimedia :: Replace Jpg Files Last Modification Date With Timestamp Creation Date?

Sep 22, 2010

I'm looking for a method for modifying some jpg photo files last modification date with the corresponding timestamp creation date of each file.The reason is that shotwell import pictures in folders according to last modification date which is stupid on my opinion.

View 2 Replies View Related

Ubuntu :: Organize Folder With Images By Date Taken Rather Than Date Edited?

Aug 1, 2011

As a photographer I'm constantly taking photos and storing them in folders. Now occasionally I'm using two cameras (either for different settings or an assistant is also taking photos) which means that for one event I can have differently named images.Both cameras have the same time set (which always helps in Windows) but in Ubuntu when trying to sort my folder by date taken I can't.The options I'm given are to sort them: Manually, by Name, by Size, by Type, by Modification date and by Emblem.Now none of those are helpful to me once I've done a few edits to the images.So please if anyone knows, how do you organise a folder with images taken on different cameras by Date Taken rather than Date Edited?

View 3 Replies View Related

Fedora :: Know The Time And Date Of A File Downloaded From The Net?

Dec 3, 2009

How do I know the time and date of a file downloaded from the net. Is it possible at all? If I want to know when the downloaded file such as a text file was created ie written by the author if not mentioed at all in the entire document. The command I use locally to know file creation time is given below.

Code:
ls -l filename.txt
-rw-r--r-- 1 root root 691 Dec 3 11:12 filename.txt

View 2 Replies View Related

General :: Set Date Time Using A File Content?

Jan 13, 2010

I have a file called foo with a date string in it - and nothing else in the file

2010.01.13-22:28:28

I want to send this file content to date -s command so I can modify using a cron job.

I tried several ways to pipe the file contents to date command but did not work.

View 4 Replies View Related

Slackware :: Slackpkg Update - File Out Of Date

Sep 13, 2010

I tried "slackpkg update", and it came back with
Code:
ERROR: Verification of the gpg signature on CHECKSUMS.md5 failed! This could mean that the file is out of date or has been tampered with. I googled this message and it pointed me to this thread: [URL]

However, when I type date I get this:
Code:
bash-3.1$ date
Mon Sep 13 19:55:31 BST 2010
Which is correct for me. Not sure what to do now.

View 7 Replies View Related

General :: Julian Date Converter To Gregorian Date

Apr 22, 2010

Anyone have a ksh solution to convert julian date to gregorian date?

View 6 Replies View Related

Ubuntu :: Add Date Suffix To File Name During MySQL Dump?

Mar 17, 2010

I have a script (below) which works ok, but I have tried to modify it as I want to keep the older files for a restore if needed. I have tried adding a date suffix to the newly created files (second lump of code), but it doesn't seem to work.I get the error:

$SOURCEDIR/p1db_$DATEVAR.sql: ambiguous redirect

The working original script:

Code:
#!/bin/bash[code].....

View 1 Replies View Related

Ubuntu :: How To Rename File To System Date In Terminal

Nov 4, 2010

is there a way in terminal to rename a file to system date?

View 2 Replies View Related

General :: Adding A Files Creation Date To It's File Name?

Sep 17, 2010

I have some basic experiencing creating simple scripts/making directories/changing permissions/etc. but I'm stumped on this one.

I have two linux boxes. I have a script set up on box 'A' to SCP into box 'B', grab a copy of a database backup and store it on box 'A'. It looks like this:

scp root@X.X.X.X:/blah/blah/blah/dump.23.gz /home/blah/DB_Backups/

I have generated a public key on box 'A' and placed it into the authorized_keys file on box 'B', so a password is not required and the file copies over successfully when the script is run. On to my problem...

I need to know what date the 'dump.23.gz' file was originally created when I'm viewing it after it's been copied to box 'A'. If I ls -l on box 'A' it only shows me the date it was created on box 'A' when it was copied.

What would I need to add to my script to append the backup's original creation date on box 'B' to the filename so that when it gets copied to box 'A' I know when the backup was created on box 'B'. I'm sure this is probably confusing. I've done lots of searching and can only find information on how to append the current date and time to a file name. I need to append it's original creation timestamp to the filename when it copies over.

View 10 Replies View Related

General :: History With Date And Executed File/command?

Feb 17, 2011

what is the tool to get the history inclduing the user name,command time and from which file/folder the command is executed.

View 1 Replies View Related

General :: Move File And Folder Date Stamps?

May 7, 2010

I wrote this little script and I need some help, I am trying to achieve following:Every day I receive new file in the /home/denis/MyData/ folder and I don't know what the file mane will be but I want to move any file that arrives there to the new location /media/DataBackup/Linux/backup/ (media/DataBackup/ is external 500GB USB drive)to automatically create new folder with the date and time stamp every day and then to move content of the /home/denis/MyData/ into the new folder with current date stamp. So every day there will be new folder and will contain files for that day only.My script is as follows:

cd /media/DataBackup/Linux/backup/
mkdir MyData_$(date +%Y%b%d_%HH%MM)
#this creates file MyData_current date and time

[code]...

View 3 Replies View Related

General :: Store The Output Of Date And Watch Command To A File

Jun 15, 2011

I am trying to watch a command and try to log it into a file. I tried

watch -t -n 10 "(date '+TIME:%H:%M:%S'
; ps aux | grep "pattern" | wc -l)" >>
logfile

and am expecting a result like

TIME: 10:32:30 12
TIME: 10:32:40 18
TIME: 10:32:50 2

to be stored in logfile. However, when the logfile has unprintable characters in in. How do I get this kind of output from the command li

View 4 Replies View Related

Ubuntu Security :: RAID 1 Drive - File Access Date

Aug 4, 2010

When I replace a drive in a RAID 1 and then resync it, why does the file access date (all the files) on the drive from which I am syncing not change? Shouldn't the file access date always change when I copy a file? Are there ways to overgo this?

View 3 Replies View Related

Ubuntu Servers :: Backup MySQL To A Date Named File?

Sep 23, 2010

I am manually backing up my server now with mysqldump and that works but I was wondering about mechanizing the process.

Nirvana would be to dump to a file named with the date

This way I have backups going back over time

View 9 Replies View Related

Ubuntu :: Filed Of /etc/passwd File Is The Login_shell \ Replace It To /usr/bin/date?

Jun 22, 2010

the last filed of /etc/passwd file is the login_shell;how if I replace it to /usr/bin/date
what would it happen.by the way I try to use $ subut do't know the password.what s the default root passworf for ubuntu

View 9 Replies View Related







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