LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2002, 09:17 AM   #1
NetScripter
Member
 
Registered: Feb 2002
Location: Russia
Distribution: Gentoo 2005.1, Ubuntu 5.10, Debian 3.1
Posts: 66

Rep: Reputation: 15
Copying directories


How can I copy all directories except one which name is known?
All directories is on the same level.
Please help
 
Old 05-24-2002, 09:27 AM   #2
vfs
Member
 
Registered: Apr 2002
Location: Brazil
Distribution: Slackware
Posts: 184

Rep: Reputation: 30
Try:

for i in ./*
do
if [ "$i" != "known_dir" ]; then
cp -a $i /destination
fi
done

Forgive me if I misunderstood.

HTH,

vfs
 
Old 05-25-2002, 12:10 AM   #3
NetScripter
Member
 
Registered: Feb 2002
Location: Russia
Distribution: Gentoo 2005.1, Ubuntu 5.10, Debian 3.1
Posts: 66

Original Poster
Rep: Reputation: 15
thanks
 
Old 05-25-2002, 12:48 AM   #4
Camion
LQ Newbie
 
Registered: May 2002
Distribution: Mandrake Debian RedHat
Posts: 10

Rep: Reputation: 0
Hi,

If your containing directory is not too large, you can also type cp -a [ESC]* Destination... at the time you type [ESC]*, it expanded (with bash) in the name of all the contained file and folders, then you remove the one you don't want from the list.

Another way, which uses grep is by using the cpio command :
find . | grep -v '/dir_name_you_don_t_want/' | cpio -pdumV dest_dir
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying linked files, replacing directories in bash scripts? ta0kira Programming 2 10-10-2004 04:46 AM
Copying a single file to multiple directories tgolly Linux - Newbie 3 04-26-2004 03:47 PM
Copying Hidden Directories Guru3 Linux - General 1 12-05-2003 12:59 PM
SAMBA copying directories thineonly Linux - Networking 6 02-11-2003 04:22 PM
copying directories jonfa Linux - General 2 11-08-2001 10:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration