GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- List File/s created yesterday and copy files to an...
Operating System - HP-UX
1843948
Members
2168
Online
110226
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
Forums
Discussions
Discussions
Discussions
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
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
11-10-2004 05:55 PM
11-10-2004 05:55 PM
I have a script the will list the file yesterday
and have it copied to another directory. But there was an error during the copy stage. Herewith is the script:
....
....
....
dta="/Informix"
export YESTERDAY=$(TZ=$(date +%Z)+24; date '+%b %e')
for i in `ls -l $dta/*PR*.res | grep -F "${YESTERDAY}"`
do
# /usr/bin/cp -p $i /test/temp
# echo "$i copied"
echo $i
done
...
The result was:
-rwxrwxrwx
1
root
sys
37533
Nov
10
07:17
/Informix/RZ1214B35YI_0443A_PR0119A_2004119_195123.res
I only needed the file RZ1214B35YI_0443A_PR0119A_2004119_195123.res
to be copied.
Maximum points for all correct replies.
Many thanks!
and have it copied to another directory. But there was an error during the copy stage. Herewith is the script:
....
....
....
dta="/Informix"
export YESTERDAY=$(TZ=$(date +%Z)+24; date '+%b %e')
for i in `ls -l $dta/*PR*.res | grep -F "${YESTERDAY}"`
do
# /usr/bin/cp -p $i /test/temp
# echo "$i copied"
echo $i
done
...
The result was:
-rwxrwxrwx
1
root
sys
37533
Nov
10
07:17
/Informix/RZ1214B35YI_0443A_PR0119A_2004119_195123.res
I only needed the file RZ1214B35YI_0443A_PR0119A_2004119_195123.res
to be copied.
Maximum points for all correct replies.
Many thanks!
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2004 06:02 PM
11-10-2004 06:02 PM
Solution
Hi,
Replace 'for i' statement with
ls -l $dta/*PR*.res | grep -F "${YESTERDAY}" |awk '{print $9}' |while read FILE
do
#/usr/bin/cp -p "$FILE" /test/temp
echo $i
done
I didn't use 'for' because if any of filenames have spaces in them. But your script needs some more work anyway.
-Sri
Replace 'for i' statement with
ls -l $dta/*PR*.res | grep -F "${YESTERDAY}" |awk '{print $9}' |while read FILE
do
#/usr/bin/cp -p "$FILE" /test/temp
echo $i
done
I didn't use 'for' because if any of filenames have spaces in them. But your script needs some more work anyway.
-Sri
You may be disappointed if you fail, but you are doomed if you don't try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2004 06:04 PM
11-10-2004 06:04 PM
Re: List File/s created yesterday and copy files to another directory
hmmm..correction time. 'echo $FILE' not 'echo $i' in my response.
-Sri
-Sri
You may be disappointed if you fail, but you are doomed if you don't try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2004 06:18 PM
11-10-2004 06:18 PM
Re: List File/s created yesterday and copy files to another directory
Thanks Sri!
I've taken care of that!
It works!
I've taken care of that!
It works!
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP