Results 1 to 8 of 8

Thread: Possible to copy from CD?

  1. #1
    Junior Member
    Join Date
    Feb 2009
    Posts
    7
    Rep Power
    16

    Possible to copy from CD?

    I've been working on a program to copy several files from a CD into My Documents. There is no error, but the files won't copy. Is there something special you have to do when you copy from one drive to another? Right now I'm just using:

    FILE_COPY("D:\copy.zip", "C:\Program Files\install\copy.zip")
    

  2. #2
    Member matthew's Avatar
    Join Date
    Mar 2007
    Location
    England
    Age
    47
    Posts
    489
    Rep Power
    66

    Re: Possible to copy from CD?

    Hi nrodes, the following script works fine for me. I was able to copy a document from a CD to my desktop using it.

    [code=thinbasic]

    uses "FILE"
    uses "CONSOLE"

    dim error

    error = file_copy("E:\Documents\MY_PDF.pdf", "C:\Users\Matthew\Desktop\MY_PDF.pdf")

    console_cls

    console_printat (error, 1, 1)
    console_waitkey

    [/code]
    Operating System: Windows 10 Home 64-bit
    CPU: Intel Celeron N4000 CPU @ 1.10GHz
    Memory: 4.00GB RAM
    Graphics: Intel UHD Graphics 600

  3. #3
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    160

    Re: Possible to copy from CD?

    Nrodes are you using Vista?

    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: Possible to copy from CD?

    When using special folders, be sure to use dedicated function OS_GetSpecialFolder(CLSID)
    Be sure to indicate in CLSID one of the supported equates (constants)

    You cannot be sure where special folders are located. They can change from computer to computer or by OS version to OS version.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    Junior Member
    Join Date
    Feb 2009
    Posts
    7
    Rep Power
    16

    Re: Possible to copy from CD?

    Quote Originally Posted by Michael Clease
    Nrodes are you using Vista?
    No, I use XP Pro

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: Possible to copy from CD?

    nrodes,

    because here it seems all is working fine with FILE_Copy function, I need to ask just few questions:

    did you solved the problem or still there ?
    Sure 100% that D: exists and CD is loaded at the time you execute the command ?
    How big is you file ?
    What are the file attributes: system/hidden/readonly ?
    Does destination path "C:\Program Files\install\" alredy exist in your computer?

    Sorry to bother you but some more info are needed.

    Thanks
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  7. #7
    Junior Member
    Join Date
    Feb 2009
    Posts
    7
    Rep Power
    16

    Re: Possible to copy from CD?

    Quote Originally Posted by Eros Olmi
    nrodes,

    because here it seems all is working fine with FILE_Copy function, I need to ask just few questions:

    did you solved the problem or still there ?
    Sure 100% that D: exists and CD is loaded at the time you execute the command ?
    How big is you file ?
    What are the file attributes: system/hidden/readonly ?
    Does destination path "C:\Program Files\install\" alredy exist in your computer?

    Sorry to bother you but some more info are needed.

    Thanks
    Eros
    I'm sure D: exists
    My file is about 1.5 GB
    File is hidden
    I'm sure directory doesn't exist

  8. #8
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: Possible to copy from CD?

    Ok thanks.

    I never tested a 1.5Gb copy with thinBasic but up to 2Gb it should not be a problem.

    Instead it is a problem if destination path does not exist. So "C:\Program Files\install\" must be checked before starting to copy a file in there.

    The following is a possible solution:
    [code=thinbasic]
    uses "file"
    uses "OS"
    uses "console"

    dim SourcePath as string = "D:\"

    '---Here it is better to use os_getspecialfolder function instaed of fixed path
    '---because "Program files" is not fixed and can be located in any place
    'dim DestinationPath as string = "C:\Program Files\install\"
    dim DestinationPath as string = os_getspecialfolder(%CSIDL_PROGRAM_FILES) & "install\"

    dim FileToCopy as string = "copy.zip"

    printl "Started " & time$

    '---Check if directory exists and if not create the full path with all intermediated paths
    '---DIR_MakeAll has power
    if dir_exists(DestinationPath) = %FALSE then
    printl "Destination dir does not exist."
    printl "Making full Destination path: " & DestinationPath
    DIR_MakeAll(DestinationPath)
    end if

    '---Check if file exists
    if file_exists(SourcePath & FileToCopy) then
    printl "Copying file " & SourcePath & FileToCopy
    printl "File size " & file_size(SourcePath & FileToCopy)

    file_copy(SourcePath & FileToCopy, DestinationPath & FileToCopy)
    else
    printl "File " & SourcePath & FileToCopy & " does not exist."
    end if

    '---Finished
    printl "Finished " & time$

    waitkey
    [/code]
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

Similar Threads

  1. only one copy running
    By sandyrepope in forum thinBasic General
    Replies: 4
    Last Post: 13-07-2007, 17:33

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •