Problem with dos commands

new topic     » topic index » view thread      » older message » newer message

Hilp (combination of Hi and help),

I had a need for a simple encryption/decryption program and decided to

write it yesterday.  I thought it would go quickly and it did, except
I wanted be able to rename files as part of the encryption process.
That's when the project headed south.  Only one of the dos commands
has worked -- the copy command.  "rename" fails.

When the rename command failed to do anything at all, I decided to
finish the project using copy to duplicate the files with a new name,
then del the original files, but the del didn't work.  Arrgh.  So, I
incorporated Daniel Bernstein's dos.e and those commands didn't work
either.  I tried the reference-manual suggested SET
CAUSEWAY=LOWMEM:80.  Again, no luck.  Here's the routine with the
troublesome code:
======================================================
function ProcessFiles(sequence path_name,sequence entry)
    integer go
    sequence src,dest
    if wildcard_file("*.bat",entry) or
       wildcard_file("*.com",entry) or
       wildcard_file("*.exe",entry) then
       --do nothing
    else
      go=Krypt(path_name & entry) --read in file, encrypt, write back
to file
trace(1)
    if equal(mode,3) then --Note: mode 3 is set when the user decides
to auto-rename the selected files
        src=path_name & entry
        dest=path_name & NewName(entry) --Newname() generates a
neutral name, e.g. xaqf0000.txt
        --system("rename " & src & ' ' & dest,2) --failed (dos
command)
        --go=copy(src,dest)                                --failed
(dos.e command)
        --go=delete(src)                                     --failed
(dos.e command)
        --system("copy " & src & ' ' & dest,2)      --worked! (dos
command)
        --system("del " & src,2)                         --failed (dos
command)
      end if
    end if
    return NOPROBLEM
end function
======================================================
I am running Windows 98 and have Norton Systemworks 2000 on it.

Any ideas?

--DB James (Quark)

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu