- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Find and I need help
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
тАО08-02-1999 10:33 AM
тАО08-02-1999 10:33 AM
Find and I need help
hear is what I'm trying to do, creat a scripts that moves any files what are
more than 7 days old to a history dir
hear is my script.
NDAYS="7"
ARDIR="/u/if/archive"
HSDIR="/u/if/history"
find $ARDIR -xdev -type f -mtime +$DAYS -exec mv {} $HSDIR \;
end of scripts
could someone tell me what i did wronf with find.
cause the only thing it moved the files but it takes the file out of the
archive dir and then moves it to /u/if with the file name of history ???? whats
up with that.....
thanx
william
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-18-1999 07:41 AM
тАО08-18-1999 07:41 AM
Re: Find and I need help
HSDIR="/u/if/history/"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-26-1999 06:29 PM
тАО08-26-1999 06:29 PM
Re: Find and I need help
the mv will then execute successfully
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-1999 03:56 AM
тАО08-31-1999 03:56 AM
Re: Find and I need help
or when i set them??
william
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-1999 03:57 AM
тАО08-31-1999 03:57 AM
Re: Find and I need help
I had tried this aswell and i ened up with the same results
thanx thou
william
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-1999 10:20 PM
тАО09-01-1999 10:20 PM
Re: Find and I need help
I think that directory pointed by $HISDIR
did not exist when you run he script for the first time.
So mv treated $HISDIR as target file to be created.
And repeated the same for each found file.
You need to:
1. delete file, now pointed by $HISDIR
2. create directory pointed by $HISDIR
3. run the script again
I guess it helps.
Pawel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-02-1999 08:29 AM
тАО09-02-1999 08:29 AM
Re: Find and I need help
me,.....interesting
william
PS does anyone know a good HP-UX book on scripts and sercrets etc???
william
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-1999 01:37 AM
тАО10-21-1999 01:37 AM
Re: Find and I need help
Hands-On KornShell93 Programming by Barry Rosenberg.
I like this book because it has many many examples and it explains why certian
commands should no longer be used.
I found this book at Borders for around $45.
Take a look at it and see if it fits your needs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-21-1999 02:00 AM
тАО10-21-1999 02:00 AM
Re: Find and I need help
mv command work by properly bracing the variable names in the find command:
find ${DIR} -type f -exec mv {} ${NEW_DIR} \;
However, this will flatten any subdirectories under your original structure.
To preserve them, I have used a two-stage process in the past:
DIR=/tmp/archive
TARG=/tmp/history
cd $DIR
find . -type f |cpio -pdumx ${TARG}
find . -type f -exec rm {} \;
And, yes, I know there is a cpio flag on find, but I have experienced
unexpected results from it in the past and prefer the flexibility and control
of the real thing. There is probably a more elegant way to do this, but this
works.