LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-05-2008, 11:39 PM   #1
iherrejon
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Rep: Reputation: 0
Unhappy How to search for a file that has the date in the filename nomenclature


Hi all,

I am new to unix/linux. I am seeking your assistance on know how to do a search for a file that has the date in the filename. The date obviously changes. Any help is greatly appreciated.

DYYMMDD.CUSA

I am lost :/
 
Old 11-06-2008, 12:38 AM   #2
centos82
Member
 
Registered: Sep 2008
Distribution: CentOS
Posts: 75

Rep: Reputation: 16
I would recommend the following:
find / -name DYYMMDD.CUSA 2>/dev/null

So if you were looking for a file with a date of Nov 6th 2008 you would do:

find / -name D081106.CUSE 2>/dev/null

Last edited by centos82; 11-06-2008 at 12:39 AM.
 
Old 11-06-2008, 09:42 AM   #3
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Might try locate:
Code:
$ locate 101107
/home/john/e_configs101107.tar.gz
/home/fred/e_configs101107.tar.gz
/etc/skel/e_configs101107.tar.gz
of course you have to know the date and format of the date in the filename.
 
Old 11-06-2008, 10:33 AM   #4
iherrejon
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you for your reply centos62. However, the filename changes as the date changes.


Quote:
Originally Posted by centos82 View Post
I would recommend the following:
find / -name DYYMMDD.CUSA 2>/dev/null

So if you were looking for a file with a date of Nov 6th 2008 you would do:

find / -name D081106.CUSE 2>/dev/null
 
Old 11-06-2008, 11:35 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Code:
find / -name D[0-9][0-9][0-9][0-9][0-9][0-9].CUSA
should do the trick?

Cheers,
Tink


P.S.: Please use proper quoting. TOFU sucks.
 
Old 11-06-2008, 11:00 PM   #6
iherrejon
LQ Newbie
 
Registered: Nov 2008
Posts: 3

Original Poster
Rep: Reputation: 0
I apologize if I didn't explain myself properly. I need to have a script in place to automatically download a file that has the previous day date in the filename. I am sorry for the confusion that I generated.

DYYMMDD.CUSA

Thanks to everybody
 
Old 11-06-2008, 11:33 PM   #7
centos82
Member
 
Registered: Sep 2008
Distribution: CentOS
Posts: 75

Rep: Reputation: 16
I don't think your requirments have been fully stated yet. Will you always be downloading yesterdays file? Will the file always be located in the same directory?

If you provide some sort of pseudo code, then I'm sure someone here could provide the actual script code.
 
Old 11-07-2008, 12:26 AM   #8
rohit_k
LQ Newbie
 
Registered: Oct 2007
Location: Pune
Distribution: RHEL, SOLARIS, SUSE
Posts: 20

Rep: Reputation: 1
find / -name D`date --date="1 days ago" +%y%m%d`.CUSA

you can replace find with wget, scp

Rohit Kalsarpe
 
  


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
Change name of backup file in ext3 from filename~ to .filename~ Libu Linux - General 2 07-21-2008 09:29 PM
Adding date to the filename ajeetraina Linux - Server 4 07-26-2007 05:34 AM
Date in a filename. Garp Linux - General 7 12-09-2005 01:57 PM
ls -R {filename} How do I search for a single file? Coldmiser Linux - Newbie 6 05-01-2004 09:06 AM
how to add date to filename x2000koh Programming 1 07-08-2003 09:44 PM

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

All times are GMT -5. The time now is 05:24 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