- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: delete files by date range
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
тАО06-05-2007 04:26 PM
тАО06-05-2007 04:26 PM
thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2007 04:48 PM
тАО06-05-2007 04:48 PM
Re: delete files by date range
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-05-2007 05:55 PM
тАО06-05-2007 05:55 PM
Solutiontry this solution:
touch -t 0701010000 /tmp/start
touch -t 0702282359 /tmp/finish
find . -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish | xargs rm
(this is based on one solution that JRF provided once)
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2007 11:11 PM
тАО06-11-2007 11:11 PM
Re: delete files by date range
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2007 11:17 PM
тАО06-11-2007 11:17 PM
Re: delete files by date range
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2007 11:19 PM
тАО06-11-2007 11:19 PM
Re: delete files by date range
You may have to execute a script so you can change the path:
find . -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish \
-exec move_them_script {} +
And the contents of move_them_script:
#!/usr/bin/ksh
for file in "$@"; do
echo mv $file new_path/
done
Make sure it does what you want then you can remove "echo".
If find returns a "small" amount of files you can do:
$ mv $(find . -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish) new_path
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2007 11:39 PM
тАО06-11-2007 11:39 PM
Re: delete files by date range
note, that Pete's and Dennis' wont preserve the directory structure the file was found but move it plain into the new directory.
So it may be, that filenames in different directories overwrite eachother.
If this is a problem, you'll have to modify Dennis' script like this:
#!/usr/bin/ksh
for file; do
np=new_path/${file%/*}
[ -d $np ] || mkdir -p $np
echo mv $file $np
done
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2007 01:17 PM
тАО06-12-2007 01:17 PM
Re: delete files by date range
to move a specific file with a specific range of modified date to other directory.
eg : to move *.t with the modified date range from 01/01/07 to 28/02/07 to /newdir
thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2007 01:33 PM
тАО06-12-2007 01:33 PM
Re: delete files by date range
-name '*.t'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-12-2007 02:51 PM
тАО06-12-2007 02:51 PM
Re: delete files by date range
find . -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish -exec mv {} /newdir \;
then i add -name *.t here on the find command (without moving)
find . -name *.t -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish \;
result : find: missing conjunction
then i try this
find . \( -name *.t \) -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish \;
result :
find: bad option OFAAAa00102.t
please help. thanks