- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mv command and sub directories
Operating System - HP-UX
1753657
Members
5856
Online
108798
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
тАО04-24-2009 04:51 PM
тАО04-24-2009 04:51 PM
mv command and sub directories
I want to move all files ending in .jpg on the root dirve to a directory called photos. Can I use mv -r /root *.jpg ~photos or something like that which is recursive and looks for .jpg files in all sub directores of the volume?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2009 07:10 PM
тАО04-24-2009 07:10 PM
Re: mv command and sub directories
find / -name "*.jpg" -exec mv {} ~/photos \;
(Unfortunately you can't use +, unless you write a script to do the mv and reverse the args.)
(Unfortunately you can't use +, unless you write a script to do the mv and reverse the args.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-24-2009 09:23 PM
тАО04-24-2009 09:23 PM
Re: mv command and sub directories
Hi Mike,
In addition to Dennis reply,
If you want to search and move only from root filesystem and do not cross other mount points use this,
#find / -xdev -name "*.jpg" -exec mv {} ~/photos \;
Question for Dennis,
#find / -xdev -name "*.jpg" -exec mv {} ~/photos +
won't this work? unfortunately not near to the system to test it..
In addition to Dennis reply,
If you want to search and move only from root filesystem and do not cross other mount points use this,
#find / -xdev -name "*.jpg" -exec mv {} ~/photos \;
Question for Dennis,
#find / -xdev -name "*.jpg" -exec mv {} ~/photos +
won't this work? unfortunately not near to the system to test it..
Best wishes,
Ganesh.
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-25-2009 03:21 AM
тАО04-25-2009 03:21 AM
Re: mv command and sub directories
>Ganesan: find / -xdev -name "*.jpg" -exec mv {} ~/photos +
>won't this work?
I tried those before replying. Neither find + nor xargs works with multiple arguments inserted other than the end.
In fact find(1) says everything from the "{}" to the "+" is replaced.
So you are left with writing a script, if you want performance:
find / -xdev -name "*.jpg" -exec move_them ~/photos {} +
move_them:
#!/usr/bin/ksh
TARGET=$1
shift
mv "$@" "$TARGET"
>won't this work?
I tried those before replying. Neither find + nor xargs works with multiple arguments inserted other than the end.
In fact find(1) says everything from the "{}" to the "+" is replaced.
So you are left with writing a script, if you want performance:
find / -xdev -name "*.jpg" -exec move_them ~/photos {} +
move_them:
#!/usr/bin/ksh
TARGET=$1
shift
mv "$@" "$TARGET"
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