- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Get the file names from a directory and run in...
Operating System - HP-UX
1748080
Members
5068
Online
108758
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 05:38 AM
тАО03-30-2004 05:38 AM
Get the file names from a directory and run in a loop
All,
I have a requirement in which the users want to get the date parameter (YYYYMMDD) format from database table and go to a remote server and look for any file name that are >= that date. The file name is in the format file_name_YYYYMMDD. The program has to pass the date protion of the filename (YYYYMMDD) as a parameter and execute in a loop for all the available files that are >= (YYYYMMDD) date.
Example:
Database date 20040312
Go to directory and look for any file that is >=20040312.
Example file_name_20040312
file_name_20040313
file_name_20040314
The program has to execute the in built shell script with the 3 date parameter in a loop
first execute run_load(20040312)
Then execute run_load(20040313)
Then execute run_load(20040314)
.
One more question.
How do I make the script to execute after every 30 mins to look for a file on the server till 11:45 AM.
Thanks
Suman
Thanks a lot!
Suman
I have a requirement in which the users want to get the date parameter (YYYYMMDD) format from database table and go to a remote server and look for any file name that are >= that date. The file name is in the format file_name_YYYYMMDD. The program has to pass the date protion of the filename (YYYYMMDD) as a parameter and execute in a loop for all the available files that are >= (YYYYMMDD) date.
Example:
Database date 20040312
Go to directory and look for any file that is >=20040312.
Example file_name_20040312
file_name_20040313
file_name_20040314
The program has to execute the in built shell script with the 3 date parameter in a loop
first execute run_load(20040312)
Then execute run_load(20040313)
Then execute run_load(20040314)
.
One more question.
How do I make the script to execute after every 30 mins to look for a file on the server till 11:45 AM.
Thanks
Suman
Thanks a lot!
Suman
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 06:44 AM
тАО03-30-2004 06:44 AM
Re: Get the file names from a directory and run in a loop
To answer your last question first, you can create an entry in the crontab for the Login ID under which you want the process to run, which would look something like this:
15,45 6,7,8,9,10,11 * * * /full/path/name/
which will run at 15 and 45 minutes past the hour from 6am to 11am. The "/full/path/name/" is the complete directroy path and file name of the script.
For the first question, you need to take the date given and calculate how many days back from today that is. Some one had a script that would give julian dates, I'll see if I can find it. If you convert today's date to julian and the database date to Julian, then it's simple subtraction to get the delta which you use in a "find" command:
find / -mtime "$DAY_BACK" -print
where $DAY_BACK is the difference calculated from today and the database date.
HTH
mark
15,45 6,7,8,9,10,11 * * * /full/path/name/
which will run at 15 and 45 minutes past the hour from 6am to 11am. The "/full/path/name/" is the complete directroy path and file name of the script.
For the first question, you need to take the date given and calculate how many days back from today that is. Some one had a script that would give julian dates, I'll see if I can find it. If you convert today's date to julian and the database date to Julian, then it's simple subtraction to get the delta which you use in a "find" command:
find / -mtime "$DAY_BACK" -print
where $DAY_BACK is the difference calculated from today and the database date.
HTH
mark
the future will be a lot like now, only later
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 07:54 AM
тАО03-30-2004 07:54 AM
Re: Get the file names from a directory and run in a loop
To increase the date, you can do it in Oracle :
select sydate, sysdate+1, sysdate+2 from dual;
with ALTER SESSION SET NLS_DATE_FORMAT='RRRRMMDD' or using to_char function to get the date formatting suiting your need.
As for the call of the shell, you can do it from SQL*Plus with the host() function or using !
select sydate, sysdate+1, sysdate+2 from dual;
with ALTER SESSION SET NLS_DATE_FORMAT='RRRRMMDD' or using to_char function to get the date formatting suiting your need.
As for the call of the shell, you can do it from SQL*Plus with the host() function or using !
All different, all Unix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2004 04:43 PM
тАО03-30-2004 04:43 PM
Re: Get the file names from a directory and run in a loop
Hi
This can be done by a simple touch and find commands
with the date you get from database
Goto the directory
touch CCYYMMDDHHMMSS sample
find . -name "*" -type f -newer sample
will five you all the files that were created after the date you passed .
so you make this as a function and call it as many time as you need it .
This can be done by a simple touch and find commands
with the date you get from database
Goto the directory
touch CCYYMMDDHHMMSS sample
find . -name "*" -type f -newer sample
will five you all the files that were created after the date you passed .
so you make this as a function and call it as many time as you need it .
Some cause happiness wherever they go; others, whenever they go
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP