Copy File From Local To Shared Folder
I have a vb6 apps that needs to copy file from local to shared folder. I thought I need to do something like:
Code: Private Sub cmdImpersonate_Click() NT4RunAsUser txtUser.Text, txtPsw.Text, txtDomain.Text, "", "" FileCopy "c:inferno.log", "\XXX.XXX.XXX.XXXSEMC_archiveinferno.txt" Logoff End Sub
where NT4RunAsUser():
Code: Public Function NT4RunAsUser(ByVal UserName As String, _ ByVal Password As String, _ ByVal DomainName As String, _ ByVal CommandLine As String, _ ByVal CurrentDirectory As String) As Long Dim Result As Long Dim hToken As Long Dim si As STARTUPINFO Dim pi As PROCESS_INFORMATION
Result = LogonUser(UserName, DomainName, Password, LOGON32_LOGON_INTERACTIVE, _ LOGON32_PROVIDER_DEFAULT, hToken) If Result = 0 Then NT4RunAsUser = Err.LastDllError ' LogonUser will fail with 1314 error code, if the user account associated ' with the calling security context does not have ' "Act as part of the operating system" permission MsgBox "LogonUser() failed with error " & Err.LastDllError, vbExclamation Exit Function Else MsgBox "Login OK" End If CloseHandle hToken CloseHandle pi.hThread CloseHandle pi.hProcess NT4RunAsUser = 0
End Function
and Logoff():
Code: Public Sub Logoff() Dim blnResult As Boolean blnResult = RevertToSelf() MsgBox "LogOff : " & blnResult End Sub
am i doing it correctly? Or I do not even need LogonUser() at the first place?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Copy Files From Shared Folder To The Local C: Folder
Hai
This is Kiran,
I am working with Access 2002 ( XP ).
I have to copy required Excel files from the shared folder to the Local system C: drive for example.
Can any one help me that how can I do it with VBA in MS Access.
Thanks in advance.
Kiran Karnati.
Copy A File From A Computer To A Shared Folder
Hi,
I want to copy a file from a computer to a shared folder on the network like this : filecopy file.txt to "\192.168.0.120folder1" , but I need to use a username and password to bo able to access that folder .
Shared.Local Folder
Is there any way to get the local location of a shared folder, that is the local location on the machine that is serving the folder. So if I looked at the shared folder \ServerFolder I could find that it is located at C:Folder on the server. Now that I think about it, if that is not possible then is there a way that if I put the local address in the comment section of the shared folder that I could get the comment information? Thanks in advance for any help!!
Copy Files Onto Shared Folder
i have a partial Program that Watches a directory tree for a changed
file, once it Flagged changed i need somthing that scans a network
shared Folder for a duplicate name and then once found
then it copies it over ,, can anyone help me
Copy Files On A Remote Shared Folder
I have creat an application to backup folders from a computer to another computer.
My application is installed like NT service with System account.
But system ac**** did not have necessary rights to copy files to a remote shared folder.
My Question is how can i develop on Visual Basic with API use to copy files with user and password like this ?
FileCopy("c: estsigzip.zip","\serversharedigzip.zip","domainuser","password")
Thanks
Copy Shared File
I am writing a backup program and it works as long as no-one has the file open because it returns error 70 "Permission denied".
Does anyone know a way of coping a file whilst the user has the file open?
Accessing A File In A Shared Folder
Hi,
How can I access a file in a password protected folder? Let's say the password's "abc123".
Basically, there's a file I need to read in a password protected folder that my system administrator insists cannot be shared globally.
Thanks in advance.
HOw To Copy A File From Local PC To FTP Server.
Hi....
After logged in FTP server, i want to copy a file from Local pc to FTP server. The bellow command not working, it shows 'Access is denied.'.
So what i have to change in this command. please give some script or suggestions.
ftp> lcd C:Folder1subfolder
Local directory now C:Folder1subfolder
ftp> put test.txt
200 PORT command successful.
550 test.txt: Access is denied.
Many many thanks
Radhakrishnan
Copy File From Website To Local PC
Hi,
Is it possible to copy a database from a remote server (hosted website) on the form load so I can use it for an application.
I've tried:
Private Sub Form_Load()
FileCopy ("ftp://gotelsolutions.com/test.mdb"), ("C:INVOICEPRGM")
End Sub
This comes back with a run-time error 52 - bad file name??
Any suggestions. I'm trying to get the database that holds the web orders so I can use it in an invoice program that will generate invoices based of this data.
Copy File To A Location On Local Computer
I have a file that I want to copy to either the C:WINNTSYSTEM32 or C:WINDOWSSYSTEM32 folder depeding on the OS when the person clicks on a command button named install
Private Sub cmdOK_Click()
End Sub
the file I am trying to copy is name reg.exe
how is this done?? is it possible??
Want To Copy A File From Local Server Through FTP Or HTTP
hi,
i want to copy an EXE file of 5 mb from local server to a client machine by using HTTP or FTP.
because to avoid windows secuirties over LAN. im using INET control of vb using binary trasfer but it not works properly.
plzzz help me to solve this matter its very urgent!!!!!!!!!!
Thanx
How To Copy A File From Local To Remote Computer
i have a program which has to accept a path name from the user and then i want to copy this file from the local computer to a remote computer. is there way to accomplish this?
any help given is greatly appreciated
xtoph
HOw To Copy A File From Local PC To FTP Server Using Batch File..
Hi...
After logged in FTP server, i want to copy a file from Local pc to FTP server. The following command not working, When i execute the bellow command it shows 'Access is denied.'. i.e file is not copied
into FTP server.
So what i have to change in this command. please give some script or suggestions.
ftp> lcd C:Folder1subfolder
Local directory now C:Folder1subfolder
ftp> put test.txt
200 PORT command successful.
550 test.txt: Access is denied.
Many many thanks
Radhakrishnan
Copy File From Remote Machine To Local Disk.
Hi There,
I had develoepd a small appl that need to copy file from some other server/client on internet instead of reading it from there to reduce performance degradation of my appl. Can any tell me what control/class module or any method that can help me.
Moreover I know the computer by only its URL address.
Thanks.
Naresh.
New Folder, Folder Exists , File Exist Copy File
Hello,
I want to perform the following task through VB 6.0
How to check Folder if Exist or not , If not exist then create it. If exist then find a given file name Ex. "Abc.Mdb", if exist then delete it and copy new file from App.Path if not exist then copy File from App.Path
Please help me
Farooq
Copy An Internet File To Local File?
It I have a file that is zipped at www.MySite.com/file.zip,
I can open this link with code, and it is downloaded. But, is there a way for code to take the file and insert it into a given location, without the prompt for saving it to a location? Basically, I want to insert an internet file into my app folder.
Find All Computers In The Local Area Network (LAN) And Their Shared Folders
hi!
I need an example how to find all computers in the Local Area Network and all shared folders. The names of the computers should suffice! (the names of the users would also be nice but in my program they are not necessary)
For example:
In the network there are 3 computers "PC1", "PC2" and "PC3"
then I should find the shared folders:
"\PC1Folder1"
"\PC1Folder2"
"\PC2Folder1"
"\PC2Folder2"
"\PC2Folder3"
"\PC3Folder1"
........
Can anybody give me an example?
Thanks!
XoRiC
Shared Folder Creation And User Creation And Accessing Shared Folder Using User Id
hi,
I want to create a shared folder called 'Accounts' as Accounts$ in windows 2000 pro, windows server 2000, windows XP,windows 2003 server?
I want to create a shared folder called 'Accounts' in windows 98 with password protection.
Also I want to create a user called 'AccUser' with password 'AccUser' in windows 2000 pro, windows server 2000, windows XP,windows 2003 server?
How can access the folder 'Accounts' using AccUser userid from VB 6 application?
Regards
S. Muhilan
Move Files To Network Folder And Then Delete Old Ones At Local Folder
I am new at programming with VB6 and I would like to get some help.
I am trying to write a function meeting the following criteria:
* Moves all files (total of 3 files with different extensions)at a local folder (C:GraffitiWork) to a mapped network folder (that is persistent in drive lettering)and then
* replaces the files in the local folder with new ones that are blank (from another local folder named C:GraffitiMaster)
I have looked at the tips using the SHFileOperation function but when I looked at the msdn site, it states that "...you cannot use SHFileOperation to move special folders from a local drive to a remote computer by specifying a network path."
I need to have this done in order for a project to transfer these files on the command of the user to the network folder and then replace it with blank files for the next day's work.
Any help will be appreciated
Create New Folder Into A LAN Shared Folder
Hi, as the tittle says, I need to create a new folder from my PC into other LAN shared folder, I'm using a FileSystemObject to create the folder but this returns the "Access Denied" error # 70. How I can solve this !?
Thanks !!!
File Copy In New Folder
What code would i need (not just filecopy) to become that when a user pushes a button, he gets a saveas dialog box. The object of the saveas box is a file thet i specified ( a database ).
A suggested name (backup_database.mdb) should already be placed (he can still change it, in the box).
The suggested target path is a folder (backups) that may or may not exist already.
If it is the first time he pushes the button, the folder should not yet exist.
thx for any help and i hope i made myself somewhat understandable
Folder And File Copy
Option Explicit
Private Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Long
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As String
End Type
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Public Sub CopyFolder(ByVal Source As String, ByVal Dest As String)
Const FO_COPY As Long = &H2
Const FOF_NOCONFIRMATION As Long = &H10
Const FOF_CREATEPROGRESSDLG As Long = &H0
Const FOF_NOCONFIRMMKDIR As Long = &H200
Const FILE_FLAGS = FOF_NOCONFIRMATION Or FOF_CREATEPROGRESSDLG Or FOF_NOCONFIRMMKDIR
Dim typFO As SHFILEOPSTRUCT
Dim lngReturn As Long
With typFO
.wFunc = FO_COPY
.fFlags = FILE_FLAGS
.pFrom = Source & vbNullChar & vbNullChar
.pTo = Dest & vbNullChar & vbNullChar
End With
lngReturn = SHFileOperation(typFO)
End Sub
im using the above code and when there is a error in the file copy it closes down my program.
how can i write a error handler in to this please, any help would be greate
Copy File To Folder
can anyone give me a VB code to copy a file to a folder given the path of file as well as folder
for eg : file path C:aaa.exe
folder path c:Temp
Copy File To Folder
hey, i was wondering if it were possible to copy a file to a folder using vb
File/folder Copy
Is there an easy way to copy a folder and all its sub folders and files?
Copy File To A Folder
I have scheduled backup file (BK.bkf) overwritten daily.I want to copy this backup file to a folder. The folder is going to hold the daily backup files with different names,so that i will have 30 files at the end of the month.
can you help me with VB script or any other scripts to automate the job.
Thanks
Why you worry? Life is too short to worry.
How To Copy File Into Folder
I'm developing an application to enable user to copy selected file to new folder but i'm not sure how to do & what command need to used.
Please Help me.
Sync/compare Folder On FTP With Local Folder??
Can anyone help with some code/examples og how i would go ahead to compare and sync any LOCAL folder with an FTP folder.
To start off "simple" lets keep it to one-way-sync'ing... from LOCAL to FTP
It must be able to sync the folders file's and subfolder's !!!
So sync ex: C:myfiles to ftp://someftp/myfiles
How can this be done the simplest way possible.. i mean..
If a file is deleted from any LOCAL(/subfolder) then it will also be deleted from FTP(/subfolder) and ofcourse this program must upload the files too... hehe
Any code examples, suggestions, helpfull hints.. and so on?!?!
Selective Folder/File Copy
Hi All.
I've searched your forum, but can't find an answer to my problem. Does anyone know how I can copy the contents of a folder (including the folder itself) according to the date the contents were last changed?
I've been looking at the FileSystemObject reference, but can't find any properties that look at the Folder Contents for the Date, Archive Bit etc.
Any help would be REALLY appreciated - I'd like to get this done during the holdidays whilst I have time.
Regards,
Chris147.
Copy File To Public Folder
I'm just learning about Exchange Public Folders. I know it's possible to email to files to a Public Folder and I'm sure I'll be able to accomplish this through VB.
However I have also read that you can copy files to a Public Folder from Windows Explorer. So I'm guessing that if you can do this manually you can also do it through VB. Is this the case?
I guess I'd need to know the 'path' to the public folder and then just copy my files? Is this correct?
Does Anyone Know How To Create A New Folder And Copy A File Into It??
Hello everyone,
I was wondering if anyone can show me how to create a new folder and copy an existing file into the new folder using vb code. Basically, I want the function to create a new folder called "Test" in "C:project" and copy a file called "Textfile.txt" into "C:projectTextfile". Thank you!
Marci Sarwan (marci_sarwan@yahoo.com)
P.S. I would really appreciate it if you can please provide
some sample code along with the explanation. Thanks!
How To Copy File On A Network Folder
Hello friends,
i want to know how to copy file to a network folder i have used following statement but it works some time and some time it gives path /file access error
close 'Statement to close any open file
filecopy "C:111.txt","\ntsdumpdata111.txt"
I have full access to the network folder and its subfolder
Thanks
kapil
Copy File In A Read-only Folder
Hi,
I am developing an Access application and i need to solve this problem:
in a form the user can copy a file in a folder of the lan but the file can not be modified after he has copied it.
If I set the user permission in the folder as read-only, of course I get an error when use CopyFile of File System Object.
If I set the attribute of the file as vbReadonly, the user could change it.
I don't want to map the folder with a special user in the code, because the user is already logged.
Thanks for helps and ideas
Paolo
Need Help Making A Copy File-folder App...!!!
can sumone please help me code an app im trying to make..
I want this app to check all Removable Storage drives { E: F: G: H: I: J: } and C:RECYCLER all at the same time in a constant
infinite loop for files & folders, and then copy-mirror all of them including the drives subfolders & files & folder tree structure over to a corresponding drive folder in a destination folder located at C: 1
BUt i also want this app to rename files it tries to copy over if both source and destination files have the same name, so nothing in the destination folder ever gets overwritten or deleted..
Whats the easiest way to do this.
I tried to make a Quick Batch App that used "HSTART" & "ROBOCOPY"
but i couldn't seem to find a code or switch for the app to rename files it tries to copy over if both source and destination files have the same name..
{>BATCH CODE <}
:UP
tasklist | find /i "R-copy-1.exe" && goto SKIP-1
start %MYFILES%hstart.exe /nowindow "%MYFILES%R-copy-1.exe C:RECYCLER C: 1REC /XX /mir /r:0"
:SKIP-1
tasklist | find /i "R-copy-2.exe" && goto SKIP-2
start %MYFILES%hstart.exe /nowindow "%MYFILES%R-copy-2.exe E: C: 1E /XX /mir /r:0"
:SKIP-2
tasklist | find /i "R-copy-3.exe" && goto SKIP-3
start %MYFILES%hstart.exe /nowindow "%MYFILES%R-copy-3.exe F: C: 1F /XX /mir /r:0"
:SKIP-3
tasklist | find /i "R-copy-4.exe" && goto SKIP-4
start %MYFILES%hstart.exe /nowindow "%MYFILES%R-copy-4.exe G: C: 1G /XX /mir /r:0"
:SKIP-4
tasklist | find /i "R-copy-5.exe" && goto SKIP-5
start %MYFILES%hstart.exe /nowindow "%MYFILES%R-copy-5.exe H: C: 1H /XX /mir /r:0"
:SKIP-5
tasklist | find /i "R-copy-6.exe" && goto SKIP-6
start %MYFILES%hstart.exe /nowindow "%MYFILES%R-copy-6.exe I: C: 1I /XX /mir /r:0"
:SKIP-6
tasklist | find /i "R-copy-7.exe" && goto SKIP-7
start %MYFILES%hstart.exe /nowindow "%MYFILES%R-copy-7.exe J: C: 1J /XX /mir /r:0"
:SKIP-7
cls
GOTO UP
Copy+moving File And Creating Folder That
My first post, this forum is great.
I searched and found how to move a file to a diff. dir using FSO object. Here is my situation. I want to create the destination folder so it displays that days date.
I'm moving "c:projects*.fdd" files ----> c:projects?
Where the question mark is i want a folder created to reflect that days date.
Thanks.
File System Object Copy Folder
I'm copying a folder from one drive to another for backup purposes. In the folder that I am coping are other folders and files.
There is one file in one of the subfolders that a machine has open and is writing data to that causes the "Permission Denied" error. I don't really care whether I copy this file or not, I just don't want the error message. (It won't copy from windows explorer either xp-sp2 or 2000)
Any one have any suggestions on how to get around this? Would CopyFile work? I was hoping not to have to open each subfolder and use filecopy but if that's what it takes.
CODE'this will copy the entire folder and all subfolders to the master directory
fso.CopyFolder fld.Path & "" & Subfld.Name, BackupMaster & "" & NDFRTF & "" & Subfld.Name
How To Copy Folder/s And Its Content To A Server(file)
hi guys,
I tried to use the function copyfolder, but it didn't work.
what's wrong?
for example. i want to move or copy "ripley" folder to "\bubblesmactanflex" server. how will I do that? what's the proper syntax for this?
thanks a lot and have a nice day.
Shared Folder?
Hello!
I would like shared a folder in VB?
(WInnt and win98)
How can i do?
THank's !
Cybercool
Shared Folder
Hello!
I would like share a folder in VB source code.
How can i do?
Thank
Cybercool
Shared Folder
Hi
Does anyone know how to unshare a path through API?
Thanks in advance
Washington
Log On To Shared Folder With Api?
Hi,
I need to fetch a file from a shared folder via a vb app. The app is on win98, and the remote machine will be win98, but may be win2k in the future. I will use the FileSystemObject to search and find it, then I'll either be doing FileCopy to bring it local or just Open it remotely to read it, but I get an error because I haven't logged onto the shared folder--it is password protected. How do I use code (some api perhaps?) to log on in code to this folder?
Thanks,
--Jsteph
How To Log Onto A Shared Folder
Greetings guru's!
My problem is that I need to log onto a remote share so that my client apps can see my shared database. At present, I have to log onto the share through explorer. Is there a way to do this in vb? Has anyone done it or seen an article on it? If so, please point me in the right direction.
Thank you all
How To Copy A File Located In TIF/Content.IE5 Folder To Desktop?
I wish to write a VB program to copy files located in "C:Documents and SettingsABCDLocal SettingsTemporary Internet FilesContent.IE5" folder to desktop. I tried using FileCopy or fso.CopyFile function, but both of them did not work. Pls advise how could I copy a file from Temporary Internet FilesContent.IE5 folder to desktop. Many thanks.
|