![]()
[<<]Message[>>] [<<]Author[>>] [<<]Subject[>>] [<<]Thread[>>]
Number : 4104 Date : 2003-03-22 Author : meirman@e... Subject : Re: copying folder(s) and retainning the original date Size(KB) : 6
At 03:43 PM 3/16/03 -0800, theTop wrote: >Hello, > >Is it possible to copy folder(s) and retainning the >original date on the destination location with xxcopy? > Have any of you tried this? I looked through xxcopy >/help and tried some swithes but unable to get what I >want. I use win98SE. > >Thanks > >ps. Do you know of such a tool that can do this. A partition copy, like comes with most partition managers, or iiuc Powerquest's Drive Image and a couple similar products will do this, but I'm pretty certain only for an entire partition. Of course there are definitely times when one wants to do this for less than a partition, a directory** and subdirectories**. And I too would like to be able to do this. It would make the recent directory entries in my backup partition look more like the original. I've been thinking about this for quite a while, and I'm thinking someone (Kan?), could write a bare knuckles method of doing this. Kan knows most/all DOS command internals, but there are only a few functions one would need: the ability to identify a directory** entry and distinguish it from a file entry; the ability to read the date and time of the entry. (That's only two, plus any related instructions needed to get there.) Then one could use that datetime to reset the system clock (there are two clocks, but I think it's the system clock that matters here) to the datetime of the source directory, and create the target directory. Then go on to each of the other directories and do the same thing. Finally, reset the datetime to the original. Plainly, nothing else could be running when this ran or any files saved would have incorrect dates, and that can really mess things up (at least dates later than now can, maybe earlier.) And it would be ironic if, in trying to make backup dates accurate, one screwed up the dates of non-backup files. Kan has a lot on his plate, and it's not for me to tell him what to do. I don't even know DOS fully yet and I don't know all the features of 4DOS, and there may be other utilities already written to identify directory entries and extract the date time. (4DOS is very useful for writing batch files and for manipulating strings of text data. These sound useful here. But it's easy for me to push $DOS, because I've already paid for it (~$65 iirc. I bought it when I worked in dos all the time.) Is Kan or anyone interested in pursuing this? **I didn't like the change to the words folder and sub-folder just because I don't like change, and I don't want to have to learn something new. But I see there is an English problem too. I assume MS? switched to folder to make it easier for (low-level?) business types and consumers who are used to folders but who find "directories" a difficult concept. But to me, "folder" includes both the directory and all the contents of the folder, that is, all the files in it. I think theTop is really talking about the directory, (the list of files with their dates and times, and their computer addresses, but not the files themselves), since there is no problem retaining file dates and times. "Directory" is used a lot on this list, and now I think I see why. To give people a head start, I would suggest: Dir [drive:][path] /s > c:directory.txt ** rem Then read the directory one line at a time, looking in the proper columns for . rem If one has 4DOS, the first line should be the TREE command.**** rem Even if one doesn't have 4DOS, maybe one can make the DOS6 TREE command work.****^ rem Then extract the date and time from the proper columns using the string and substring commands. rem Then format date and time commands with the text variables*** extracted in the previous line. XXCOPY that one directory. rem One doesn't know that subdirectories have the same date and time. Continue. If one wished, only the directories need be created on this pass, and then a regular XXCOPY run can fill in all the files. So we don't need any DOS command internals to do this, only 1) a method to read redirected output or a text file one line at a time, and I'm pretty sure I've seen that already. 2) perhaps a method to break up what for some will be an enormously long list of directories and files. WRT 2) above, it might be better to read the redirected output. Perhaps it wouldn't be necessary to create a directory.txt file, at all. Even if it was done, one could check the correct columns for directory entries, and discard any line that represented only a file. Then he would save only directory lines. **** !!!! If one has 4DOS, the first line should read "Tree C: /B/T/H dir:" . Then every line is a directory entry. Dir: is the directory to use as the start of the tree, or it uses one's "current directory". More than one directory can be specified. A batch file which calls this can have sufficient parameters to pass at least 10 directories, iirc. /B eliminates indentation and graphics and puts a fully qualified directory name on each line. /T includes the date and time on each line. /H finds hidden directories. A simple version of this seems like it would not take much time. Making it versatile and easy to use might triple the time. ****^ There doesn't seem to be a DOS7 TREE command, and currently my DOS6 TREE command won't work in DOS7/Win98, because it says "Incorrect DOS Version". But with the SETVER command, this should be able to be overcome. OK, there doesn't seem to be a SETVER command in DOS7 either. Maybe one could boot to DOS7 and then start a DOS6 shell. Well, I can't do that from a DOS6 box. It says "Incorrect DOS Version". Maybe there is some way to run a TREE command in DOS7, or a third-party TREE utility we could use. Aha, XXCOPY has an option to copy only directories. It runs in DOS7 and it could probably write the kind of file we need. Enough for now. I'm worn out. I apologize for the stream of consciousness style, but I'm too tired to rewrite it. And leaving in my dead-ends will help if someone knows that I gave on some method too quickly. **One can write this so that it knows it is a file, not a directory, but I can't keep that straight. If one can't, sample 4dos batch files show how to answer the question that DOS will ask with an "F" with no user intervention required. ***mostly numbers but they have -'s and :'s. I think 4dos might allow one to set the date and time in one command, but it's almost as easy without that. Meir meirman@e... Baltimore, MD, USA
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.