Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • Last Modified:

Copy file from CD to hard drive

Hi

I'm trying to copy file from CD  to hard drive
and i get file not found it's dose'nt work with app.path
(the file that i try to copy is in the dir in the cd)

can i get sample how it's has to work currect

Regard Kobi
0
Kobi55
Asked:
Kobi55
1 Solution
 
aelatikCommented:
It goes like this :

FileCopy "D:\BIN\FILE.DAT C:\FILE.DAT"
0
 
aelatikCommented:
Sorry typo, like this :

FileCopy "D:\BIN\FILE.DAT", "C:\FILE.DAT"
0
 
aelatikCommented:
Oo, misunderstood the question.
What do you get when you do msgbox app.path ( is it the CDROM drive ? )
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Kobi55Author Commented:
it's not work from app.path

for exsample my  CD is "E" and my folder in the CD is "Files"

i try "curdir" and "dir" and with file "systemobject "and it give me the error  "file not found"
0
 
EDDYKTCommented:
Where is your program? Is it reside on CD or hard drive.
If it is in hard drive, then app.path will not work
0
 
nffvrxqgrcfqvvcCommented:
' put the following code into a module .BAS file
'

Public Const PROGRESS_CANCEL = 1
Public Const PROGRESS_CONTINUE = 0
Public Const PROGRESS_QUIET = 3
Public Const PROGRESS_STOP = 2
Public Const COPY_FILE_FAIL_IF_EXISTS = &H1
Public Const COPY_FILE_RESTARTABLE = &H2
Public Declare Function CopyFileEx Lib "kernel32.dll" Alias "CopyFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal lpProgressRoutine As Long, lpData As Any, ByRef pbCancel As Long, ByVal dwCopyFlags As Long) As Long
Public bCancel As Long
Public Function CopyProgressRoutine(ByVal TotalFileSize As Currency, ByVal TotalBytesTransferred As Currency, ByVal StreamSize As Currency, ByVal StreamBytesTransferred As Currency, ByVal dwStreamNumber As Long, ByVal dwCallbackReason As Long, ByVal hSourceFile As Long, ByVal hDestinationFile As Long, ByVal lpData As Long) As Long
   
    Form1.Caption = CStr(Int((TotalBytesTransferred * 10000) / (TotalFileSize * 10000) * 100)) + "% complete..."

    DoEvents
   
    CopyProgressRoutine = PROGRESS_CONTINUE
End Function

'put this code in a command button or wherever you want to put it to copy the file from cd
'

Dim Ret As Long
    Me.AutoRedraw = True
    Me.Show
    'start copying
    'change manual.pdf to the filename
    Ret = CopyFileEx("E:\Files\MANUAL.PDF", "c:\MANUAL.PDF", AddressOf CopyProgressRoutine, ByVal 0&, bCancel, COPY_FILE_RESTARTABLE)
   
0
 
gbzhhuCommented:
This works just fine for me.  F is my CDROM drive

    Dim fso As FileSystemObject
   
    Set fso = New FileSystemObject
   
    fso.CopyFile "F:\Hassan\Reg Clean\Readme.txt", "D:\Readme.txt"
   
    Set fso = Nothing

Make sure the CDROM drive is readable by trying it manually
0
 
AerocomCommented:
Rember after you have copied the file to the hard drive to check and re-set the property - its will be read only on the CD!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now