Copy file structure but not files?

Copy file structure but not files?

Post by Mark S. Halegu » Sun, 22 Jul 2001 23:57:45



I've looked in a command reference and I can't find a command to
accomplish the following:
    copy the directory structure of a file system without copying the
    files in each directory/subdirectory.

Is it possible to do this, or will I have to write my own routine?

I'm using the standard shell (bash) with SuSE 7.1

Thanks.

Mark

 
 
 

Copy file structure but not files?

Post by Swif » Mon, 23 Jul 2001 00:05:57


On Sat, 21 Jul 2001 10:57:45 -0400, Mark S. Halegua


> I've looked in a command reference and I can't find a command to
> accomplish the following:
>     copy the directory structure of a file system without copying the
>     files in each directory/subdirectory.

> Is it possible to do this, or will I have to write my own routine?

> I'm using the standard shell (bash) with SuSE 7.1

find $PLACE -type d -exec mkdir $OTHERPLACE/'{}' \;

With $PLACE being the root of the directory-hierarchie. So if you want to
copy the dir-structure of /var into /home/user/tmp/var, you would do

find /var -type d -exec mkdir /home/user/tmp/var/'{}' \;

--
 SwifT                     -    Key-ID CDBA2FDB
 LUG: http://www.lugwv.be  -    http://www.keyserver.net

 
 
 

Copy file structure but not files?

Post by Michael Heimin » Mon, 23 Jul 2001 00:27:45



> I've looked in a command reference and I can't find a command to
> accomplish the following:
>     copy the directory structure of a file system without copying the
>     files in each directory/subdirectory.

> Is it possible to do this, or will I have to write my own routine?

> I'm using the standard shell (bash) with SuSE 7.1

I don't know of any single command for this task.

'for i in `find /path  -type d`; do mkdir /tmp$i; done'

May be something simple to start with.

Michael Heiming

 
 
 

1. I want to not copy exclude one file when i Copy

I wnat to exclude not copy one file from folder. I copy all folder
/usr/local and in that folder is subfolder /usr/local/web/logs/ when is
file cgisock which i don't want to copy because he give me error.
Itrying something like that

cp -p -r /usr/local /test >/home/fi/raport 2>&1 | grep "cgisock"

but all files copyig with cgisock wich give me error what can I do with
that file never coping how I can exclude for cp please help me???

--
seboizm

2. Quicktime Viewers Under Linux ?

3. q: chmod and copying files dir structure

4. descriptor file not large enough to add another drive to rootvg

5. copying a directory structure with a particular file in directories below

6. Looking for libjpeg-devel

7. Bash shell script to sort files by date and copy to directory structure

8. kdm vs xdm

9. deleting a line in a file, where file is in directory structure

10. gdb: core file not in executable format: File format not recognized

11. Copying files across file systems

12. Programming simple file copy, move, and other file mngmnt routines

13. to copy file from remote file system