Well yeah, I tend to use scripts as they are easier to modify for other tasks. If someone decides for example they only want to copy folders from a hierarchy that have been labelled yellow, it's a fairly trivial addition to a script but not as easy with a command-line. The command-line is fine for when you only need one line. When it gets to situations with more than one pipe, I find it takes longer to get it work properly. Plus it's easier to test the commands before running them to make sure that it won't do something disastrous.
find . -type d -print0 | cpio -o -O > DIRLIST (To test before actually doing anything)
To extract it:
cpio -i < DIRLIST (then do it)
Well sure, but in this case I think a script would just add complexity to a simple solution. I do like your script though, love Python as well but I normally use Perl or CShell when dealing with files.
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
use File::Path;
my ($source, $target) = @ARGV;
my @paths;
find sub {push @paths, "$target/$File::Find::name" if -d and not
/^\.{1,2}$/;}, $source;
mkpath "$_" for @paths;
Oh here is one more way of doing it;
cd destination/dir
find /source/dir -type d -printf "%P\n" | xargs mkdir -p
Easy? Not in my world. Changed the path names and copied/pasted to terminal. Just errors, errors, errors. May be i.e spaces or umlauts are still too much. Tried to mask them, but did help nothing. Maybe you first have to learn the complete language from ground up before using a single bit.
Finally the AppleScript by Whyatt Thrash did the job. Thank You! Slow, but much faster them watching errors in terminal.
Easy? Not in my world. Changed the path names and copied/pasted to terminal. Just errors, errors, errors. May be i.e spaces or umlauts are still too much. Tried to mask them, but did help nothing. Maybe you first have to learn the complete language from ground up before using a single bit.
Finally the AppleScript by Whyatt Thrash did the job. Thank You! Slow, but much faster them watching errors in terminal.
Would it be possible to see the errors you were getting in the terminal, copy the echoed text to this thread or do a screen shot. It's a very simple fix ounce I know where the terminal commands are stalling at.
Terminal script or combine applescript and unix commands ca n help you to copy the folder structure of a given folder without copying all the files. I have done and its working correctly.
Comments
find . -type d -print0 | cpio -o -O > DIRLIST (To test before actually doing anything)
To extract it:
cpio -i < DIRLIST (then do it)
Well sure, but in this case I think a script would just add complexity to a simple solution. I do like your script though, love Python as well but I normally use Perl or CShell when dealing with files.
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
use File::Path;
my ($source, $target) = @ARGV;
my @paths;
find sub {push @paths, "$target/$File::Find::name" if -d and not
/^\.{1,2}$/;}, $source;
mkpath "$_" for @paths;
Oh here is one more way of doing it;
cd destination/dir
find /source/dir -type d -printf "%P\n" | xargs mkdir -p
Easy? Not in my world. Changed the path names and copied/pasted to terminal. Just errors, errors, errors. May be i.e spaces or umlauts are still too much. Tried to mask them, but did help nothing. Maybe you first have to learn the complete language from ground up before using a single bit.
Finally the AppleScript by Whyatt Thrash did the job. Thank You! Slow, but much faster them watching errors in terminal.
Easy? Not in my world. Changed the path names and copied/pasted to terminal. Just errors, errors, errors. May be i.e spaces or umlauts are still too much. Tried to mask them, but did help nothing. Maybe you first have to learn the complete language from ground up before using a single bit.
Finally the AppleScript by Whyatt Thrash did the job. Thank You! Slow, but much faster them watching errors in terminal.
Would it be possible to see the errors you were getting in the terminal, copy the echoed text to this thread or do a screen shot. It's a very simple fix ounce I know where the terminal commands are stalling at.
Using a Python script or terminal commands would be much faster than a Applescript.
JK, thanks for this! Here's a little improvement for those who like to keep their folder icons and labels:
rsync -Ea [/path/from/] [/path/to/] --include="*/" --include="Icon*" --exclude="*"
Terminal script or combine applescript and unix commands ca n help you to copy the folder structure of a given folder without copying all the files. I have done and its working correctly.
Thanks,
Tom kalili