in reply to Re^2: how to copy source folder excluding specific set of sub folder from parent folder
in thread how to copy source folder excluding specific set of sub folder from parent folder
soonix already pointed out the issue around . and .. directory traversals. You'll need to keep track of visited directories to avoid looping over them again. There's also one more path that you can look into:
$searchfile =~ /^\.svn$/; print "$searchfile\n"; rmdir $searchfile; if ( -d $searchfile) { &traversedir($searchfile); } else { last; }
Now, this is not necessarily a problem - but you are not really checking for .svn folders, merely matching and overwriting the $searchfile variable. What do you think would happen if there were no match? :-)
That said, what's wrong with just doing svn export $srcFolder $targetFolder? It doesn't look like you're doing it as an exercise (those vhdl, rtl, sim folders?) If you have svn installed, you already have this tool at your disposal. Why reinvent the wheel? :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: how to copy source folder excluding specific set of sub folder from parent folder
by soonix (Chancellor) on Aug 14, 2016 at 09:58 UTC | |
by robby_dobby (Hermit) on Aug 14, 2016 at 14:08 UTC | |
by soonix (Chancellor) on Aug 14, 2016 at 17:56 UTC | |
by robby_dobby (Hermit) on Aug 16, 2016 at 09:26 UTC |