I did a variation on this and got it to work. I made the top level dir 'Dir2' cd into Dir1 and the 'rsync -va . ../Dir2/ cd into Dir2 find . -type f -name "*.txt" -exec unix2dos "{}" \; that did it. I didn't put the "" around the {} the first time and it barfed on the files with spaces in them. Thanks everybody for all the suggestions. On Fri, 2007-12-07 at 09:28 +0000, G T Smith wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Randal Jarrett wrote:
I've already been through these cmds and many more but I have been unable to come up with a combination that will convert the files and then put them in a new structure that has all the same subdirs that the original has.
get file, convert file, put file in the same subdir as original but in new structure.
I have the new directory structure built. That was easy, find . -type d -exec mkdir -p ../Dir2/{} \; where Dir1 was original and Dir2 is the new structure.
I just haven't come up with the right combination to put the files in the proper subdir under Dir2. I'm also having problems with
<snip>
Anyway, here are some of the elements you have to work with:
- The "find" command It has an option ("-print0") to print file names with NUL termination instead of the usual newline termination.
- The "xargs" command It has an option ("-0"), a counterpart to find's -print0, that makes it read file names with NUL termination
- The "unix2dos" command This does the basic text file format conversion.
IMHO Not really doable as a single command line, though someone will no doubt prove me wrong :-) ....
Something like....
find <base directory>/* -type d >scandirs while read SCANDIR; do do stuff with $SCANDIR done < scandirs
as a template for a script may work... If you know little about bash scripting it looks like now is the time to learn....
if the directory structure is not too large putting the results of the find command in a variable and feeding the variable to a for loop and or to xargs may work (but xargs does have some limitations).
This is only a pointer to an approach...
BTW Please think before you place your answer, I am personally not particularly religious about the Top Post vs Bottom Post argument... (Strikes me as rather like the big-endian vs little-endian war in Gullivers Travels) but it is a good idea to try an retain something resembling a consistent flow to the history of an argument when replying.....
Probably time to put on the asbestos underwear :-)
<snip>
- -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone.
Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org
iD8DBQFHWRIgasN0sSnLmgIRAlhDAJ9MVozGMNhFxTUvtBjVC/HydAfXgwCcDHGu IVm3htF7iRg2CcuwVwFtgKE= =Kt+p -----END PGP SIGNATURE----- --
Randal Jarrett <rsj@radio.org> RSJ Consulting, Inc Hernando, FL (352) 419-0112 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org