filemtime

Restore modification times after vc operations

早过忘川 提交于 2020-01-25 06:06:09
问题 Make is purely timestamp-oriented: if a source is older than its target, the target gets rebuilt. This can cause long recompilations in big applications if one does some major version control detour. Let me give you an example. Suppose I have an old feature branch which didn't get merged yet, and I want to see how it's doing. So starting from master, I would checkout that branch, then merge master into it, then compile. All very fine, and if the feature was small, then differences vs. master

filemtime returns same value before and after modification of file

北慕城南 提交于 2019-12-31 00:58:11
问题 Im trying to get the last modified time of a file before and after i write to it using fwrite. But, i get the same values for some reason. <?php $i = filemtime('log.txt'); echo gmdate("h:i:s", $i); echo "<br/>"; $e=fopen('log.txt', 'w'); fwrite($e, "well well well"); $j = filemtime('log.txt'); echo gmdate("h:i:s", $j); ?> Now i modify 'log.txt' with a text editor about a minute before i run this script. So i should be getting about 40-60 seconds of time difference. If someone could point out

find files modified between two dates using php

断了今生、忘了曾经 提交于 2019-12-25 02:26:23
问题 I'm getting thoroughly confused about the various date functions and formats in php so I would like to ask for help if possible. I'm trying to find files that were modified between two dates but the syntax is confusing me. For instance, if I tried to find files altered between 6 months and 1 year ago, I have tried: $yearago = new DateTime("now"); date_sub($yearago, date_interval_create_from_date_string("1 year")); $sixmonthsago = new DateTime("now"); date_sub($sixmonthsago, date_interval

Find files modified within one hour in HP-UX

余生长醉 提交于 2019-12-22 00:25:21
问题 I'm searching through the manual page for find I can't see a way to run a command which will find all files modified within an hour. I can see only a way to do it for days. 回答1: Guess this should do find / -type f -mmin -60 This will be listing files starting from root and modified since the past 60 mins. 回答2: the best you can do in HP-UX using the find command is to look for everything that was modified in the last 24 hours. The HP-UX find command only checks modified time in 24-hour

Cost of file modification time checks

a 夏天 提交于 2019-12-21 03:44:26
问题 For a file containing few bytes under Linux, I need only to process when it was changed since the last time it was processed. I check whether the file was changed by calling PHP clearstatcache(); filemtime(); periodically. Since the entire file will always be tiny, would it be a performance improvement to remove the call to filemtime and check for a file change by comparing the contents with the past contents? Or what is the best method for that, in terms of performance. 回答1: Use filemtime +

PHP filemtime vs MySQL last updated timestamp for image caching in CMS

微笑、不失礼 提交于 2019-12-12 21:17:00
问题 I'm trying to determine if it's better to store an image's last modified date in a MySQL database or use the PHP function filemtime. In my case, all of the website info is stored in a database (cms), so there is always a query to pull the image path, etc. The question is for caching purposes I need to have my HTML output something like this <img src="/img/photo.jpg?v20190613" /> . From what I read on the php.net website this function is cached. So would it use fewer resources to add a field

PHP Recursively File Folder Scan Sorted by Modification Date

匆匆过客 提交于 2019-12-11 01:58:59
问题 I'm using this script to see all subfolders and files of subfolders function readfolder($dir) { global $tfile,$tdir;$i=0;$j=0;$myfiles; $myfiles[][] = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file=readdir($dh)) !== false) { if (!is_dir($dir."\\".$file)) { $tfile[$i]=$file; $i++; echo $dir."\\".$file." <b>File</b><br>"; } else { if (($file != ".") && ($file != "..")) { $tdir[$j]=$file; echo $dir."\\".$file." <b>Directory</b><br>"; readfolder($dir."\\".$file); $j++; } }

Preserve timestamp with Paramiko

余生颓废 提交于 2019-12-10 04:35:06
问题 Is there a way of preserving the timestamp when using Paramiko to SFTP files from one server to another similar to the -p argument in Linux? Original file: jim@vm3634:~$ ls -la -rwxrwx--- 1 jim admin 2214 Mar 30 17:33 compcip.asc Uploaded file: sftp> ls -la -rwxrwx--- 1 no-user no-group 2214 Mar 30 18:49 compcip.asc The uploaded file needs to have the same timestamp as the original. 回答1: Paramiko does not support that. You have to explicitly call the SFTPClient.utime after the upload. Note

filemtime() [function.filemtime]: stat failed for filenames with umlauts

早过忘川 提交于 2019-12-09 08:51:07
问题 I use the PHP function filemtime to get the last modification time with PHP 5.3. This functions works very well but it seems to have some problems when the filenames have special characters (for example umlauts). If I run it on a filename with umlauts $stat = filemtime('C:/pictures/München.JPG'); then I get the output: Warning: filemtime() [function.filemtime]: stat failed for C:/pictures/München.JPG If I rename the file from "München.JPG" to "Muenchen.JPG" and do the same thing again: $stat

Preserve timestamp with Paramiko

馋奶兔 提交于 2019-12-05 07:11:37
Is there a way of preserving the timestamp when using Paramiko to SFTP files from one server to another similar to the -p argument in Linux? Original file: jim@vm3634:~$ ls -la -rwxrwx--- 1 jim admin 2214 Mar 30 17:33 compcip.asc Uploaded file: sftp> ls -la -rwxrwx--- 1 no-user no-group 2214 Mar 30 18:49 compcip.asc The uploaded file needs to have the same timestamp as the original. Paramiko does not support that. You have to explicitly call the SFTPClient.utime after the upload. Note that pysftp (that internally uses Paramiko) supports preserving the timestamp with its pysftp.Connection.put()