timestamp is used for questions that are about data specifying seconds since the epoch (19700101T00:00:00) or possible some other standard, and also for (date) and time information in filenames.

learn more… | top users | synonyms

4
votes
1answer
227 views

How to determine if cp -u actually copied the file?

As the title says, I'm looking for a concise way to check if a file was copied using cp -u. I have a little shell script which updates quite a number of files. At the moment the script echoes a ...
2
votes
2answers
64 views

Change file timestamp and display hour instead of year with ls

I want to change a file's date to tomorrow 21:00. I used touch, but when I type ls -l the year of the file is displayed instead of the hour. -rw-r--r-- 1 ABCD DEF 0 sept. 30 2014 test01 -r-xr-xr-x ...
0
votes
3answers
128 views

How do I substract 5 minutes from a Unix timestamp?

I have a date in milliseconds since Unix epoch format, how do I substract 5 minutes from it?
1
vote
1answer
76 views

How do I convert a date to milliseconds since Unix epoch in bash?

I've got a date in format: 22-Sep-2014 10:32:35 I need a 13-digit timestamp, but when I convert this way time=$(date -d "$DATE" '+%s') I get a 10-digit number When I try tt=$(date -d ...
1
vote
2answers
66 views

finding latest date and date modified file and using sed

I have a series of files that contain a date and I need to get the file which has the latest date, and the latest date modification and pipe it to sed. I have tried various approaches and I cannot ...
0
votes
2answers
50 views

Remove by date in Shell Script

I have a shell script that creates a backup of a database. I would like to keep the last 7 days for files. What is the syntax I need to remove files in a directory by date or can I keep the newest 7 ...
2
votes
1answer
36 views

Can you change timestamp format for history command on tcsh

When I run history command (on tcsh), it only prints the TIME portion of the timestamp and omits the date: 3 15:07 echo $PATH 4 15:07 ls -la In bash, you can use HISTTIMEFORMAT ...
0
votes
0answers
44 views

get time of file in inotifywait tool

for this script: inotifywait -m /path -e create -e moved_to | while read path action file; do echo "The file '$file' appeared in directory '$path' via '$action'" # do something with the ...
0
votes
4answers
47 views

Find a directory created today

How can I find a directory whose name starts with cy and that was created today?
1
vote
0answers
50 views

In Emacs' org-mode, any way to hide the subtree with timestamp not set to today?

I just started to learn org-mode (and Emacs) and I plan to use it as a calendar/timetable/todo-list hybrid. Is it possible to hide entries with timestamp not set to today? If so, how? For example, ...
6
votes
4answers
125 views

Find newest file. Multiple Filetype restrictions

I want to write a command that gives me the newest file in a directory recursively. But that's not my only limitation. The files has to be an mp3 or a jpg file. (case insensitive prefered) I only need ...
2
votes
4answers
132 views

Change to the last modified subdirectory of the current directory

I have an application which generates a couple of files in different directories at a regular interval and I need to check the latest files generated, i.e. the file which is generated in the most ...
1
vote
4answers
82 views

Finding a file which created X minutes back (without GNU/BSD find)

I am using the find command to find the files which were created with in 30 minutes. find . -ctime -30m But it is giving files from up to 30 days. I have tried -mmin too but it is showing that ...
0
votes
1answer
52 views

Mount changes directory time to 1970

We are developing an embedded Linux system using BusyBox v1.19.4. The system is working fine except for a strange mount issue with time and date. When we create a directory it has the correct time ...
2
votes
2answers
204 views

Difference between `ls -c` and `ls -t`

What is the difference between -c and -t options for the ls Unix command? And how can I sort by date of creation with the ls command?
3
votes
3answers
370 views

Moving latest files from one directory to another

I'm trying to move newest files from one directory to another directory. The find command finds the files but not moving them to another directory. The destination directory exists. $ cd ...
1
vote
1answer
61 views

Does “freshening” a zip file with the -FS option change the modification time of the file?

I have a zip file that I use as a backup for my work. I use the "freshen" option (-FS) whenever I want to update my backup file. However, the file shows the date of last modification as being the ...
1
vote
1answer
68 views

creation time attribute on CIFS

I have a linux server which captures network pcap files and save it to a CIFS shared drive. I have found out that the creation time and modified time of the pcap files seems to be the same. Which ...
2
votes
3answers
271 views

When was a file last opened?

How do I determine, when a file was last opened? I've looked at man ls (using GNU coreutils 8.22) and I don't see anything about this timestamp.
1
vote
1answer
259 views

ls shows a timestamp with no time for a file on NFS

When we create a file on Linux we notice that the timestamp is not visible and the stat on the file shows a time in future, the filesystem is an NFS mount, has anyone seen this before? ...
1
vote
3answers
98 views

How do I set a file's mtime in epoch format?

I know how to get a file's mtime in epoch format: stat --format=%Y <file> But I have not been able to figure out how to set a file's mtime in epoch format. The touch(1) man page appears to ...
2
votes
1answer
90 views

Set file creation date to its modification date on OSX

I need to batch edit file creation date (some stupid audio recorder set the file creation date to UNIX epoch and the correct recording date in the modification date) to set it to the files ...
2
votes
1answer
529 views

What is wrong with this code?

I have a script that goes like this: while : do Start_Time=$(date +"%s") MAIN PROGRAM GOES HERE (CROPPED TO SHORTEN THINGS) Run_Time=$(( $(date +"%s") - $Start_Time )) if [[ ...
2
votes
3answers
156 views

Strange formatting of date in bash script

I am working on a script to sort my downloads folder by the date the files were created. This is the script I am using: #!/bin/bash cd ~/Downloads for FILENAME in * do if [[ -f $FILENAME ]]; ...
1
vote
1answer
66 views

Extract time stamps and find the difference

I have a large set of logs as shown below: June 5 15:51:56.606 [3997]: TR#153. State machine - state = CC_STATE_IDLE, event = EVT_ISDN_SETUP June 5 15:51:56.607 [3997]: TR#153): SC ...
2
votes
4answers
148 views

Get the latest directory (not the latest file)

My folder parent has the following content: A.Folder B.Folder C.File It has both folders and files inside. B.Folder is newer. Now I just want to get B.Folder, how could I achieve this? I tried ...
3
votes
1answer
5k views

Cron job to delete files older than 3 days

I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory /a/b/c/1 & /a/b/c/2 & /a/b/c/3) Can this be done ...
1
vote
2answers
77 views

Copying the newest files

We have a script running which picks up the report generated monthly on remote servers. I was trying to find a way to pick up the latest file from the remote servers only. Will find work in script ...
4
votes
1answer
587 views

How to understand the unix time format?

How does the Unix time format work? For example, the Unix time for 3:00 PM is: Normal time format <----3:00PM = 1402565420----> Unix Time How can I make it understand the time as 3:00 PM ?
2
votes
5answers
465 views

Listing files greater than particular timestamp in file name?

I have a directory in linux which has a list of log files where log files get auto generated if some job runs. Each log file gets appended with the timestamp like "JobName_TimeStamp" UPDATED: ...
1
vote
4answers
329 views

How do i get the latest file from a list of files in a particular directory

I need to get the latest file from a list of files in a particular directory. When I run the script the first time I've copied the list of files in a particular directory to another directory. From ...
2
votes
1answer
65 views

Is it Unix timestamp incremental?

I have a simple Python program that collect data from a sensor. The program will then send the data together with the system's timestamp to a remote server via REST POST request. If the POST request ...
1
vote
1answer
45 views

With mv, possible to put a time dependence on files mv'ed?

Let's say there's a specific time and date I have in mind. All files last edited before this date I want to keep in the directory but all files that have been edited since this date I want to mv ...
3
votes
3answers
107 views

How to display the time of sadf in epoch format

I have a problem in sadf between ubuntu and centos. The thing is how the date is displayed in both. Ubuntu: root@db1:/usr/local/nagios/libexec/nrpe_local# sadf | head -10 ...
3
votes
1answer
80 views

How does the system know when a file has been modified? In particular memory mapped files

If I am looking at a process from outside the process how can I tell which files it modifies? One thing I can do is track calls to write, but a process can map a file to memory and write to the ...
2
votes
1answer
75 views

Delete *.txt files by date between MMDDYYYY and MMDDYYYYY

How can I use rm to delete *.txt files between MMDDYYYY and MMDDYYYY ?
1
vote
2answers
240 views

How to get SCP execution time in milliseconds?

I have a script in which i am reading source and destination IP address from a csv file and recording the time in milliseconds it is taking to copy the file from source to destination (using scp). ...
0
votes
0answers
58 views

Shell script time output over java enviroment

I am running a script from java program using sshxcute API. Script contains: #!/bin/sh data=`stat -c%y filename` echo $data Script running on bash gives output: 2014-03-08 13:26:29.335545828 -0800 ...
2
votes
2answers
111 views

Stat command detail information

I am running command stat -c%y filename on linux system. Output: 2014-03-08 13:26:29.335545828 -0800 I am not able to understand the last -0800 thing. Anyone have any idea?
0
votes
2answers
2k views

copy files modified after specific date using cp switches

When I execute the command find . -mtime -60 I get the list of files modified within the last 60 days. So when I execute find . -mtime -60 -exec cp {} /tmp/1 \; I can copy these files to a new ...
1
vote
2answers
117 views

How can i keep the mtime of files and directories in bash when I use rsync or cp? For use in Backup/Incremental Backup

I have a new NAS box and after looking through numerous backup solutions I've found doing it manually through PuTTy to work the best. After logging in to the box through PuTTy as root, I first need ...
1
vote
2answers
139 views

When do inode modification times change? [closed]

I am currently reading UNIX by Bach. I encountered a problem while reading the section on inodes in the 4th chapter. A file modified time is shown as 1:45pm but the inode modified time is shown as ...
2
votes
2answers
994 views

How can I restore file timestamps of video recordings using the embedded metadata?

I'm looking for a command that will read the metadata of a ‘*.mp4’ file and touch the file's timestamp with the creation time of the video. The command should be read-only with respect to the file ...
1
vote
1answer
51 views

Is it possible to use the at command to schedule a job to run at a given timestamp?

I want to schedule a file to run using the at command, as described in this tutorial. I see that the at command supports the posix format -- but I don't see any mention of timestamps. Surely it is ...
2
votes
2answers
116 views

How to change “date modified” of multiple folders, to be the same of that of a .mkv that's inside each one, using Cygwin

How to change "date modified" of multiple folders to be the same of that of the .mkv that's inside each one. eg. there's folder1 which contains a file 1.mkv folder1: 2/17/14 1.mkv: 1/6/12 I want ...
4
votes
2answers
132 views

In Linux Fedora, How can I select files to move by time interval

How can I select and move files that were written in a specified time interval, such as 1530 to 1730 local time on a recent date? Background: I use Linux Fedora 12, and I have made my first, and long ...
3
votes
1answer
263 views

timestamp of newly created file is in the future

On my machine at work I experience weird timestamps of files. This is bothering me, because it messes with make. To reproduce the issue, this suffices: $ touch foo $ stat -c %y foo 2014-01-31 ...
1
vote
1answer
33 views

Timestamp ts not working with thinkfan

I wanted the output of thinkfan -n output with a timestamp next to it so I can later analyse the patterns, and found this question: Prepending a timestamp to each line of output from a command, which ...
2
votes
5answers
133 views

How to copy 5 newest files from one directory to another and delete the old copies

How can I copy the 5 newest files from a directory to another in a "new to old" order.
1
vote
3answers
429 views

Adding timestamp to file/dir name

I am trying to write a script, that will copy file or directory with added timestamp to filename/dirname Something like: cover.jpg --> cover_18-01-2014_17:37:32.jpg directory --> ...