LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-24-2013, 03:53 AM   #1
iruhdam
LQ Newbie
 
Registered: Apr 2013
Posts: 6

Rep: Reputation: Disabled
To check whether a directory is created today or not


Hi all,

I want to check whether a particular directory is created today or not.How can i??

Thanks in advance.

Last edited by iruhdam; 04-24-2013 at 03:54 AM. Reason: missed out a letter
 
Old 04-24-2013, 04:01 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
it depends on the filesystem. I think you can do it on ntfs, but not available on ext4
 
Old 04-24-2013, 04:04 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Try the stat cmd http://linux.die.net/man/1/stat, but note that historically, *nix doesn't have a concept of 'creation time'
https://en.wikipedia.org/wiki/Stat_%28system_call%29

Very recently, moves have been made to provide a 'birth time' as well, but this is not generally implemented as of yet.
 
Old 04-24-2013, 07:27 AM   #4
JackHamm3r
LQ Newbie
 
Registered: May 2012
Distribution: OpenSUSE, Sabayon, RHEL
Posts: 23

Rep: Reputation: Disabled
Try doing like this
# ls -dl directory

This'll show you tha date and time of creation of the directory, along with permissions although
Look for the info by the end of the STDOUT


Cheers!

Last edited by JackHamm3r; 04-24-2013 at 07:28 AM.
 
Old 04-24-2013, 09:18 AM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
As already mentioned, you cannot see the file creation time in Unix. So a little hope is to search the directory by it's last modified time. Or on the other hand, if directories are created using some script (or even manually), create them with time stamp in their names as:
Code:
~$ find /path/to/search -name 'dir_name' -mtime -1 -type d -print
~$ mkdir dir_name.$(date +%Y%m%d)
 
Old 04-24-2013, 10:11 AM   #6
Madhu Desai
Member
 
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541

Rep: Reputation: 153Reputation: 153
Code:
$ find /source-path -type d -newermt $(date +"%Y-%m-%d")
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using TAR to create backup of files created today in data directory Vi_rod Linux - Newbie 3 12-23-2011 12:00 PM
how to check the created logical drives in HP server sanjay2004 Linux - Software 2 05-24-2008 01:41 AM
is there a way to check for newly created files without having to access the mount ignarus Linux - General 3 03-05-2008 04:01 AM
how to check the date for the user ID created? dwarf007 Linux - Security 1 08-22-2007 04:00 AM
Perl: Check if file has been created in the last 10 minutes introuble Programming 2 06-02-2006 10:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration