Computing.Net > Forums > Solaris > cp command

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

cp command

Reply to Message Icon

Name: johnk
Date: October 24, 2003 at 06:29:55 Pacific
OS: solaris 8
CPU/Ram: sparc
Comment:

I was wondering if there was any way to copy a bunch of directories, but not the files under them. I have a bunch of directories I need to copy over and in each directory are three files, but I only want one of those files. Is there any varation of the cp command or any other command that can do this.



Sponsored Link
Ads by Google

Response Number 1
Name: nick
Date: October 24, 2003 at 07:18:58 Pacific
Reply:

off the top of my head i would say no, at least not w/ cp.

You could get a little creative and write a shell script to do it for you, it wouldnt that long, and pretty easy to write using any scripting language.


0

Response Number 2
Name: Danny Larouche XL2
Date: October 25, 2003 at 15:33:27 Pacific
Reply:

With the "find" command you will be able to do it.

something like:
find /dir1 -maxdepth 2 -name "filename" -exec cp -R {} /dir2{} \;


0

Response Number 3
Name: Denny Raab
Date: November 21, 2003 at 08:58:15 Pacific
Reply:

I do this all the time.
Use this:

find <your directory> -type d | cpio -pdumv <target directory>

only the directories will be copied. no files.

Good Luck,
Denny


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home


Sponsored links

Ads by Google


Results for: cp command

how to copy files from scsi disks www.computing.net/answers/solaris/how-to-copy-files-from-scsi-disks/3933.html

Install Oracle 9i on Solaris 9 www.computing.net/answers/solaris/install-oracle-9i-on-solaris-9-/2905.html

finding and copying files www.computing.net/answers/solaris/finding-and-copying-files/1444.html