Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy directories without files

Status
Not open for further replies.

zu9

Programmer
Sep 10, 2002
3
AT
Hi!
I want to copy the structure of directories to a new directory
e.g.: ./doc/2004/1250/ to ./doc/2005/1250/
renew the directory tree without copying the existing files of the previous year.
THanks a lot for help!
best regards
Matthias
 
Here is a start:
Code:
 proc recurlistdir {start} {
 global dirlist 
 foreach p [glob -nocomplain $start] {
                          if {[file isdirectory $p]} {
                               lappend dirlist $p
                               recurlistdir $p/*
                           }
                   }
return [llength $dirlist]
}

if {[recurlistdir] > 0} {
                         foreach name $dirlist {
                                 if {[regexp "2004" $name]} {
                                      regsub -all "2004" $name 2005 name
                                      file mkdir $name
                                 }
                          }
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top