- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- need info
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
10-06-2006 09:46 PM
10-06-2006 09:46 PM
need info
How to recursively search for the files into subdirectories.
Suppose i can copy files from-to location by command
cp "/home/temp/*.dat" "/home/temp10"
And in /home/temp , i have some subdirectories say "/home/temp/test2" and "/home/temp/test3" where i have some more dat files.
So how will i search all the .dat file into subdirectories?
While copying in the destination path i.e. "/home/temp10" i need that folder also should created and files should copy as below:
"/home/temp10/test2/.dat"
"/home/temp10/test3/.dat"
"/home/temp10/.dat"
How can i make directories while copying?
Thanks,
Reena
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2006 10:22 PM
10-06-2006 10:22 PM
Re: need info
How about.
# find /home/temp -name "*.dat" -xdev | cpio -pcmudv /home/temp10
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2006 06:04 PM
10-07-2006 06:04 PM
Re: need info
Thanks Robert-Jan ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2006 10:10 PM
10-07-2006 10:10 PM
Re: need info
But it copies files from the root path.
means suppose i have files in source location
/user/reena/firstfolder/backup/temp/a.dat
/user/reena/firstfolder/backup/temp/b.dat
/user/reena/firstfolder/backup/temp/aaa/bbb/aa.dat
/user/reena/firstfolder/backup/temp/aaa/bbb/bb.dat
/user/reena/firstfolder/backup/temp/ccc/ddd/aa.dat
/user/reena/firstfolder/backup/temp/ccc/ddd/dd.dat
and at destination location
/user/reena/backup/temp/
So, cp command that i am going to execute is
cp "/user/reena/firstfolder/secondfolder/*.dat" "/user/reena/backup/temp"
So i need in destnation location files to copied i.e,
/user/reena/backup/temp/a.dat
/user/reena/backup/temp/b.dat
/user/reena/backup/temp/aaa/bbb/aa.dat
/user/reena/backup/temp/aaa/bbb/bb.dat
How can copy files from source path to destination path with creating same directory structure as source location ?
Or How can i write a script to achieve this?
Regards,
Reena
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2006 10:37 PM
10-07-2006 10:37 PM
Re: need info
# cd /user/reena/firstfolder/backup/temp
# find . -xdev -name "*.dat" | cpio -pcmudv /user/reena/backup/temp
or a very simple script
#!/usr/bin/ksh
ORGDIR=/user/reena/firstfolder/backup/temp
DESTDIR=/user/reena/backup/temp
cd $ORGDIR
find . -xdev -name "*.dat" | cpio -pcmudv $DESTDIR
Robert-Jan