|
Is there a shell command to find the newest created files recursively from a root directory?
Started by Phu Son on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at serverfault):
Find /mydir -type f -exec stat -c '%y %N' {} \; | sort -n
To avoid forking one process per file checked, if you're on a machine with GNU versions of find and xargs, consider something like this:
find /dir -type f -print0 | xargs -0 stat -c '%Y %N' | ... .
|
|
Is there an elegant way in Perl to find the newest file in a directory (newest by modification date)?
What I have so far is searching for the files I need, and for each one get it's modification time, push into an array containing the filename, modification...
Started by Tom Feiner on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
You could try using the shell's ls command:
@list = `ls -t`; $newest = $list[0];
Assuming you know, then you can optimize your process by only keeping the newest modification time and associated any files around that you know are older ....
|
|
I have tried to test a few Open source codes. The problem is that these projects changes rapidly such that my code is daily old.
For example, I started yesterday to test the code at . The code at my server is already old. The problem is that all changes...
Started by Masi on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Use git-svn: http://www.kernel.org/pub/software/scm/git/docs/git-svn.html
Looks like you need to learn more about Vendor Branches . .
|
Ask your Facebook Friends
|
Hi,
I have a model like:
Question - Id - CreatedOn
Answer - Id - CreatedOn - QuestionID
No I want to get the first question with the newest answer.
I am using SQL Server 2005.
Thanks, Chris
Started by Christian on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Something like this:
SELECT TOP 1 Question FROM Questions JOIN Answers ON Questions.Id=Answers.QuestionID ORDER BY Answers.CreatedOn DESC;
select top 1 Question from questions inner join answers on questions.Id = answers.QuestionId order by answers.CreatedOn... .
|
|
I have a folder with subfolders of files. I would like to get the newest filename by modified time. Is there a more efficient way of finding this short of looping through each folder and file to find it?
Started by Lokelo on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
If you have PowerShell installed, the command would....
Do you want you software to start and then look for it or continuously run and keep track of it?
in the last case its good to make use of the FileSystemWatcher class .
Depends on how you want to do it.
|
|
I need to copy the newest file in a directory to a new location. So far I've found resources on the forfiles command, a date-related question here, and another related question . I'm just having a bit of trouble putting the pieces together! How do I copy...
Started by Devrin on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
If you need name of the newest....
And whitespace from the start/end copy resulting value Important
After running this once, the newest file
The accepted answer gives an example of using that newest file in a command and then exiting.
|
|
How can you select the titles of the newest 3 questions from PostgreSQL database by PHP?
My attempt in PHP $result = pg_prepare($dbconn, "query1", "SELECT title FROM questions ORDER BY was_sent_at_time WHERE question_id = $1;"); $result = pg_execute($...
Started by Masi on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Change your query to:
"SELECT title FROM questions WHERE question_id = $1 ORDER BY was... .
In MySQL it would look something like
SELECT title FROM questions ORDER BY was_sent_at_time DESC LIMIT 3;
Not sure if it still applies without changes to Postgres .
|
|
Assuming I have a table foo where I have something like this:
id , user_id , timestamp , some_value
What I want to do is remove all rows that aren't the newest N per user .
The deletion itself could be handled by a:
DELETE FROM foo WHERE id NOT IN (.....
Started by tliff on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
For example, if there are a total of 100 rows and you want the newest 5 to be saved, this will delete (100-5) the oldest 95 want in one statement is going to be....
This will delete all except the newest N rows.
Replacing N by your number.
|
|
I am using Python to connect to an FTP server that contains a new list of data once every hour. I am only connecting once a day, and I only want to download the newest file in the directory. Is there a way to do this?
Started by scottm on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Are you over thinking the problem by asking the server for the newest file instead of more easily.
|
|
I'm looking for a way in Windows to list all files in a given directory and its subdirectories, sorted so that the newest files are on top. Is there any easy way to do this? I'd also settle for a Perl script.
Started by Kip on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at superuser):
Files{$b} <=> $files{$a}} keys %files) { print "$key\n"; }
Files are displayed newest to oldest.
|