• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

compying text file

hi all i am wondring how can i protect my project when it played from the CD
i want to check up on the c:\ about text file named hossam that is exist on the cd when it cant be found on c:\ then i want to copy this file to the c:\ using my exe project & when i found the txt file on the c:\ so i can unload the form of my project
my question is how can i copy this file from the carent drive to the c:\ drive & how can i check it up
best regards
hossam
0
hmahfouzy
Asked:
hmahfouzy
  • 3
1 Solution
 
BahnassCommented:
about filecopy

filecopy "D:\hossam",c:\Hossam"

but what do u mean about protection ??
Eng. Ibraheem
0
 
talluri_28Commented:
hi hossam,

i am giving Code. i think it is use full to u.

Dim fso As New FileSystemObject

Public Sub Check_file()
 
   If (fso.FileExists("C:\hossam.txt")) = False then
       fso.CopyFile "c:\hossam.txt", "C:\hossam.txt"
   else
     'Unload Me 'Unload the form
     End 'Close the Application
   endif

End Sub


0
 
talluri_28Commented:
hi

u have to give the reference "SCRRUN.DLL" 'Microsoft Scripting Control'

jag
0
 
hmahfouzyAuthor Commented:
may please explain where can i put this code in the declaration or else ?
thanx
0
 
talluri_28Commented:
Hi

If u want to use fso oject entire form u can declare in Declatation, other wise u can declare where u r using particular procedure

sorry previously i was written like this

fso.CopyFile "c:\hossam.txt", "C:\hossam.txt"

please modify that to

fso.CopyFile "D:\hossam.txt", "C:\hossam.txt"

tnx

jag


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

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