- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- moving files by date
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
Forums
Discussions
Discussions
Discussions
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
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
02-06-2001 11:54 AM
02-06-2001 11:54 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2001 12:24 PM
02-06-2001 12:24 PM
Re: moving files by date
here=/tmp/test
there=/tmp/test
for month in Jan Feb # etc
do
(( day = 0 ))
while (( $day < 31 ))
do
(( $day = $day + 1 ))
[ ! -d $there/${month}.${day} ] && mkdir $there/${month}.${day}
there=$there/${month}.${day}
ll $here | tr -s '[:space:]' | awk "/$month $day/"'{print $NF;}' |
while read file
do
mv $here/$file $there/
done
done
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2001 12:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2001 12:38 PM
02-06-2001 12:38 PM
Re: moving files by date
[ -f $file ] && mv $here/$file $there/
so you don't affect directories and such
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2001 01:58 PM
02-06-2001 01:58 PM
Re: moving files by date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2001 01:10 PM
02-07-2001 01:10 PM
Re: moving files by date
A postscript (pun intended).
'find' is intended to descend a directory structure. In some cases, you may want to limit this action. For instance, if you had subdirectories and files therein, upon which you did not want 'find' to operate, you could add the
# find . ! -newer myfile -prune -type f -exec mv {}
The "-type f" selects only regular files; not directories, etc. The "-prune" keeps 'find' from examining the contents of the subdirectory in the first place.
Regards!
...JRF...