I'm trying to make an application which sends a directory which contains a tree of files/directories from one computer to another one.
I've searched but I couldn't find much. Is there any ready function?
How do I to proceed with this please?
Thanks a lot !
EDIT:
OS: Windows 7 SP1.
IDE: VS2013.
I think using FTP can be a good method.
WinInet and libcurl have function relative FTP.
Many developers have been recommanding using libcurl rather than using WinInet.
However, it depends complexity and scale of your application.
The by far easiest would be to use a network share resp. share a directory on the target computer. That would work with *nix systems as well, using Samba. If that's possible the operation boils down to simple file system copies. If that's not possible:
I think you must create an archive of the directory tree before you can send it through a network connection. You could call that serializing. .NET 4.5 has built-in support for creating zip files, cf. http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive%28v=vs.110%29.aspx.
How to traverse a dorectory tree is shown in http://msdn.microsoft.com/en-us/library/07wt70x2%28v=vs.110%29.aspx.
How to use FTP programmatically is shown in http://msdn.microsoft.com/en-us/library/ms229715%28v=vs.110%29.aspx. But you'll need a running FTP server on the remote machine.
The remaining problem is how to unzip the file at the destination. For that you'll need a logon.
Related
I've been going through the windows documentation for the Dism API with the goal of writing an exe in C++ (or whatever language can accomplish this) that can create a WIM image while running in Windows PE. I found a .NET Wrapper for the Dism API that seems like it might be useful for this purpose, but I'm unsure if a .NET app will successfully run in Windows PE. Overall, my problem is that I don't see a function that can create--and doesn't simply modify--a wim file.
If I didn't care about encapsulating this in an .exe file, the Dism documentation does show how to initially create a wim--which makes me curious why a similar function wouldn't exist within the api. Please advise if the simplest solution is to have my code call a function such as system() within the code.
To summarize, I'm looking for a way to create a wim file programmatically (called from executing an exe file) from within Windows PE.
As always, thank you for the help and advice.
I work on a project that works with DISM in WinPE quite a bit. We configure WinPE with all the .net packages as described here. Then WinPE can be configured to start an application.
I use c#, but you can do managed apps in c++ as I'm sure you know. I find putting c# code into WinPE substantially easier, but that's more a function of my experience, I suppose.
The main way we use to interact with DISM is run a command using System.Diagnostics.Process. The process runs in a separate thread, but the API is simple, and you can wait on (and/or timeout) your process for synchronization purposes. This just uses the DISM command line interface, although you can also use powershell cmdlets if you've added that package to your WinPE image. It may seem like a hacky "interface" from your app to DISM, but it works reliably, and you can keep the process window from showing up on the screen. This makes for a decent asynchronous platform for running bunches of windows imaging utilities, such as DISKPART, DISM and BCDEDIT.
The principal way you'd capture a new image is with DISM /Capture-Image. Sounds like you've already discovered this fact. Lots of options that are somewhat beyond the scope of this q/a, but I hope this gets you on a useful path.
Even though this post is a bit older, here is a possibly still relevant resource for you. Perhaps this one will help.
I've written a small GUI-based tool, project-named WIM-Backup, that uses the Windows Imaging Format (WIM) to create full backups of computer systems (operating system images) within WinPE and then restore them.
The application is hosted on GitHub, is open source, and is offered under the Apache 2.0 license.
In addition, the repository includes an illustrated step-by-step guide to help get it up and running.
Brief summary:
WIM-Backup always requires an external bootable media such as a USB flash drive.
From this drive WinPE is booted to perform a backup or restore to or from an external medium (e.g. a USB hard drive).
On the bootable USB flash drive the WinPE must be set up before (is documented illustrated in the readme).
After completion of the respective operation, a status message is displayed whether the operation was successful or failed.
After restoring a backup, you can boot normally from the destination drive.
Both the backup and restore process are relatively simple (not "rocket science").
To set up the solution, you need about 30 minutes time in the best case due to the necessary downloads (e .g. ADK)
Last but not least: it has a permissive license (non-proprietary) and is open source.
The project can be found here: WIM-Backup
I am trying to connect my scidb server directly via sockets using C++ under windows environment (Winsock2).
I could only find a python example below for the above purpose which seems quite outdated.
https://github.com/artyom-smirnov/scidb4py
The .proto file shipped with the SciDB 14.12 and the one used in the python example are very much different so the example does not work with the SciDB 14.12.
If someone could help me with preferably a C++ (Windows/Linux) working example or update the existing python example.
Atleast if someone could guide me to the documentation part which explains how to use the message format outlined in the .proto file and what to expect in return.
Thanks.
I believe what you may be looking for is https://github.com/Paradigm4/shim.
It is a HTTP API for SciDB. All you have to do is to install this together with your SciDB. You would then use directly your Winsock (or a HTTP protocol library) directly in C/C++, connecting to the SHIM instance.
When moving files around locally within my project I'm able to use
return QFile::copy(fromPath, toPath);
I need to do something similar but with the fromPath being located on the web.
What is the best way to accomplish this?
QFile works with local file only.
If you want to copy remote file from web, then you need to download it using QNetworkAccessManager
Install on your source and destination machine ssh. Then do a scp via QProcess.
This is one way. The best? Depends on your requirements. You can also write a program for your destination machine, which accepts incoming TCP connections from your source machine. Then you connect via QTcpSocket and send your data. Qt4 has a QFtp class. Never used it. Is also a dead end, since it does not exist anymore in Qt5. But maybe it is good enough for your current needs.
I hope you did not expect a more specific answer. There is not 'remoteQFile::copy' command. And there is no general 'best way'.
i am trying to create a C++ program on Windows machine which has to execute a program on remote machine, transfer the generated file to local machine. The remote machine is also windows.
Is there any efficient method to implement it without using MFC? Is it possible to do it without server/client component?
Regards,
Adil
I don't recommend coding your solution since other solutions already exist. One of them is Rsync, which is pretty popular in *nix circles.
A Windows friendly version also exists, and it's called DeltaCopy.
Unless you're trying to improve your skills, or have the time, or you believe you can do better, stick with proven solutions.
There are any number of windows remote shell solutions that will allow you to do this without programming. You can also use a remote desktop client.
use ftp command from c++ or Cleint/Server.
I am writing a test program to copy some file in Application data folder on device to release directory on desktop.
I am not sure how to access release dir on desktop?
Is there any shell command to do that?
Basically I want to write c++ program that will run on device to accomplish this task.
This article gives a description of how to use RAPI to copy files from the WinCE device to your PC:
http://www.codeguru.com/cpp/w-p/ce/article.php/c3521
However, RAPI is something that only runs on the PC, so it won't work for your purposes.
There are a few ways to handle device-initiated communication like you want to do. In my world (.NET/C#) it is easy to set up a simple ASP.NET web service running on the PC and have the device talk to it (to upload a file the device would send the file as a byte array, and the web service would then save it to the desktop).
Since you're not using .NET, your best solution is probably FTP from the device. Here is an article that shows how to do it:
http://msdn.microsoft.com/en-us/library/ms901267.aspx
I found the solution
There is API called CoyFile that can copy to release dir.
CopyFile(Src file,Dest file,FALSE);
Destination file can be given as
ce::wstring = L"\release\foo.txt";