Dear,

We have reinvest the problem again. Thanks NTDOC.

We make a distinction between operations with "\" as specification.
Also we take a look at DOS commands for COPY, DEL, MOVE and XCOPY.

btw: the manual doesn't specify the requirement of "\" at the end. A "\" specification
makes it clear, that is handling directory names. Without it can be a directory, but also
a file.
of course the specification of "\" makes the type of disk-entry (has we to deal with a file
or directory) more clear.

So we create a new structure
code:
x:\dir1
file1
file2
dir11
file1
file2
x:\file1

DOS command COPY:

- COPY x:\dir1 x:\file1
system ask for overwrite. "file1" is a combination of "x:\dir1\file1" & "x:\dir1\file2"
- COPY x:\dir1\ x:\file1\
returns "invalid directory"
- MKDIR x:\dir3
COPY x:\dir1\ x:\dir3\
the "x:\dir3" will contain a copy of "x:\dir1\file1" & "x:\dir1\file2" as separate files.

DOS command XCOPY:

- XCOPY x:\dir1 x:\dir3
as user
Does x:\dir3 specify a file name or directory name on the target
(F = file, D = directory)?D
file1
file2
2 File(s) copied
- XCOPY x:\dir1\ x:\dir4\
the directory "x:\dir4" will be created automatically.
the "x:\dir4" will contain a copy of "x:\dir1\file1" & "x:\dir1\file2" as separate files.

When we are running following script
code:
; copy "source"  "destination"  /H /S
; del "x:\file" "name" /H /S
; move "source" "destination" /H /S
?
? @kix
?
? "-copy-"
?
COPY "x:\dir1" "x:\dir3a" /h /s ? ".1.. @error (@serror)"
COPY "x:\dir1\" "x:\dir3b\" /h /s ? ".2.. @error (@serror)"
COPY "x:\dir1" "x:\dir3c\" /h /s ? ".3.. @error (@serror)"
?
COPY "x:\dir1" "x:\file1a" ? ".4.. @error (@serror)"
COPY "x:\dir1" "x:\file1b" /h /s ? ".5.. @error (@serror)"
COPY "x:\dir1" "x:\file1c\" /h /s ? ".6.. @error (@serror)"
?
? "-move-"
?
COPY "x:\dir1" "x:\dir6a\" /h /s MOVE "x:\dir6a" "x:\dir7a" /h /s ? ".1.. @error (@serror)"
COPY "x:\dir1" "x:\dir6b\" /h /s MOVE "x:\dir6b\" "x:\dir7b\" /h /s ? ".2.. @error (@serror)"
COPY "x:\dir1" "x:\dir6c\" /h /s MOVE "x:\dir6c" "x:\dir7c\" /h /s ? ".3.. @error (@serror)"
COPY "x:\dir1" "x:\dir6d\" /h /s MOVE "x:\dir6d\" "x:\dir7d" /h /s ? ".4.. @error (@serror)"
? ;-
COPY "x:\dir1" "x:\dir6a\" /h /s MOVE "x:\dir6a" "x:\dir8a" /h ? ".5.. @error (@serror)"
COPY "x:\dir1" "x:\dir6b\" /h /s MOVE "x:\dir6b\" "x:\dir8b\" /h ? ".6.. @error (@serror)"
COPY "x:\dir1" "x:\dir6c\" /h /s MOVE "x:\dir6c" "x:\dir8c\" /h ? ".7.. @error (@serror)"
COPY "x:\dir1" "x:\dir6d\" /h /s MOVE "x:\dir6d\" "x:\dir8d" /h ? ".8.. @error (@serror)"
? ;-
COPY "x:\dir1" "x:\dir6a\" /h /s MOVE "x:\dir6a" "x:\dir9a" ? ".9.. @error (@serror)"
COPY "x:\dir1" "x:\dir6b\" /h /s MOVE "x:\dir6b\" "x:\dir9b\" ? ".10. @error (@serror)"
COPY "x:\dir1" "x:\dir6c\" /h /s MOVE "x:\dir6c" "x:\dir9c\" ? ".11. @error (@serror)"
COPY "x:\dir1" "x:\dir6d\" /h /s MOVE "x:\dir6d\" "x:\dir9d" ? ".12. @error (@serror)"
? ;-
COPY "x:\file1" "x:\file9a" MOVE "x:\file9a" "x:\file7a" ? ".13. @error (@serror)"
COPY "x:\file1" "x:\file9b" MOVE "x:\file9b\" "x:\file7b\" ? ".14. @error (@serror)"
COPY "x:\file1" "x:\file9c" MOVE "x:\file9c" "x:\file7c\" ? ".15. @error (@serror)"
COPY "x:\file1" "x:\file9d" MOVE "x:\file9d\" "x:\file7d" ? ".16. @error (@serror)"
?
? "-del-"
?
DEL "x:\dir8a\" /h /s ? ".1.. @error (@serror)"
DEL "x:\dir8b\" /h ? ".2.. @error (@serror)"
DEL "x:\dir8c" /h /s ? ".3.. @error (@serror)"
DEL "x:\dir8d" /h ? ".4.. @error (@serror)"

will return following screen output
code:
4.21 Release Candidate 2

-copy-

.1.. 87 (The parameter is incorrect.)
.2.. 3 (The system cannot find the path specified.)
.3.. 0 (The operation completed successfully.)

.4.. 87 (The parameter is incorrect.)
.5.. 87 (The parameter is incorrect.)
.6.. 0 (The operation completed successfully.)

-move-

.1.. 87 (The parameter is incorrect.)
.2.. 87 (The parameter is incorrect.)
.3.. 87 (The parameter is incorrect.)
.4.. 87 (The parameter is incorrect.)

.5.. 0 (The operation completed successfully.)
.6.. 0 (The operation completed successfully.)
.7.. 0 (The operation completed successfully.)
.8.. 0 (The operation completed successfully.)

.9.. 0 (The operation completed successfully.)
.10. 0 (The operation completed successfully.)
.11. 0 (The operation completed successfully.)
.12. 0 (The operation completed successfully.)

.13. 0 (The operation completed successfully.)
.14. 123 (The filename, directory name, or volume label syntax is incorrect.)
.15. 0 (The operation completed successfully.)
.16. 123 (The filename, directory name, or volume label syntax is incorrect.)

-del-

.1.. 0 (The operation completed successfully.)
.2.. 0 (The operation completed successfully.)
.3.. 2 (The system cannot find the file specified.)
.4.. 2 (The system cannot find the file specified.)

Implementation of above output learn us
- using end-symbol "\" in your directory/file name isn't always clear.
sometimes we must specify it in the source-name. in other situations it is
required in the destination-name.
- way COPY is working isn't similar with COPY dos command.
- kixtart command MOVE doesn't recognize "/S" parameter. in our opinion it can't
be a parameter at all in an MOVE operation.
- DEL command doesn't delete empty subdirectories when "/s" parameter is specified.
currently it deletes only existing files in subdirectories and subdirectories.

Our suggestions are
  • using end-symbol "\" in your directory\file name specification will be
    interpretated as directory name
  • using NO end-symbol "\" in your directory\file name specification means
    kixtart will check what kind of type entry is it. A directory or a file.
    f.e.
    - COPY "old_entry" "new_entry"
    means that file "old_entry" will copied to file "new_entry". it works like DOS command COPY.
    means that directory "old_entry" will create the directory "new_entry" before copying entries
    to the directory "new_entry". it works like DOS command XCOPY.
    - COPY "old_entry" "new_entry\"
    means that "old_entry" will copied to directory "new_entry\", when it exist.
    kixtart will return an error, when the directory "new_entry\" doesn't exist.
    - MOVE "old_entry" "new_entry"
    means the same as a RENAME of file- or directory name. the "/h" parameters can
    handle also HIDDEN files or directories.
    .
    Of course it can be interesting, that users should specified end-symbol "\" for
    specifying a directory entry. Useful because the COPY, MOVE and DEL can have an
    enormous impact when they are specifying the "/s" parameter too. An user doesn't
    get warnings, but they only see the results.
  • remove "/S" parameter in kixtart MOVE command. it has no meaning by a
    move operation.
    currently it returns an error message.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA