LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 04: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 04:54 AM. Reason: missed out a letter
 
Old 04-24-2013, 05:01 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,797

Rep: Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888
it depends on the filesystem. I think you can do it on ntfs, but not available on ext4
 
Old 04-24-2013, 05:04 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,412

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 08: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 08:28 AM.
 
Old 04-24-2013, 10: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, 11:11 AM   #6
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:00 PM
how to check the created logical drives in HP server sanjay2004 Linux - Software 2 05-24-2008 02: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 05:01 AM
how to check the date for the user ID created? dwarf007 Linux - Security 1 08-22-2007 05:00 AM
Perl: Check if file has been created in the last 10 minutes introuble Programming 2 06-02-2006 11:58 AM

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

All times are GMT -5. The time now is 12:07 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration