LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-19-2011, 05:27 AM   #1
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Rep: Reputation: Disabled
how to just copy the folder not the file


for example:

jizhen
parallel double cylinder
shuipingdanyuanzhu
shuzhidanyuanzhu
vertical double cylinder

./jizhen:
wujizhen

./jizhen/wujizhen:
171
80
xin129
xin80

./jizhen/wujizhen/171:
0000.txt
000100.txt
000101.txt
000102.txt
000103.txt
000104.txt
000105.txt
000106.txt
000107.txt
....



I only want to copy the "./*" not the "000*.txt"
thanks.

Last edited by ytyyutianyun; 11-19-2011 at 05:34 AM.
 
Old 11-19-2011, 05:32 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You can try rsync to take advantage of the --exclude and --include options. For example this will copy the whole directory structure source into destination, without copying any file inside it:
Code:
rsync -av --include '*/' --exclude '*' /path/to/source /path/to/destination
 
1 members found this post helpful.
Old 11-19-2011, 05:47 AM   #3
ytyyutianyun
Member
 
Registered: Nov 2011
Posts: 63

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colucix View Post
You can try rsync to take advantage of the --exclude and --include options. For example this will copy the whole directory structure source into destination, without copying any file inside it:
Code:
rsync -av --include '*/' --exclude '*' /path/to/source /path/to/destination
Thanks, it's helpful.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Restore copy folder&file permission aiushtha Programming 3 12-21-2010 10:02 AM
i cannot copy a file to a folder in file system with my root account realbezo Linux - Newbie 4 03-03-2009 11:45 PM
Copy a file into another directory and keep its folder hierarchy? Zebe Linux - General 2 11-25-2008 05:47 PM
copy a file to all subdirectories in a folder raj000 Linux - General 6 03-24-2006 04:55 AM
can copy-paste or create new file/folder, if boot from live cd gjo Linux - Distributions 3 09-17-2004 09:43 AM


All times are GMT -5. The time now is 03:13 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration