?
Solved

Copy file from CD to hard drive

Posted on 2005-03-08
8
Medium Priority
?
340 Views
Last Modified: 2008-02-01
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
Comment
Question by:Kobi55
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 14

Expert Comment

by:aelatik
ID: 13485444
It goes like this :

FileCopy "D:\BIN\FILE.DAT C:\FILE.DAT"
0
 
LVL 14

Expert Comment

by:aelatik
ID: 13485448
Sorry typo, like this :

FileCopy "D:\BIN\FILE.DAT", "C:\FILE.DAT"
0
 
LVL 14

Expert Comment

by:aelatik
ID: 13485458
Oo, misunderstood the question.
What do you get when you do msgbox app.path ( is it the CDROM drive ? )
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Kobi55
ID: 13485600
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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 13485660
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
 
LVL 29

Accepted Solution

by:
nffvrxqgrcfqvvc earned 2000 total points
ID: 13485686
' 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
 
LVL 12

Expert Comment

by:gbzhhu
ID: 13485708
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
 
LVL 1

Expert Comment

by:Aerocom
ID: 13488228
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question