Need Recommendations for an Easy Way to Move Files Using .NET/C++

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 964 Views - Last Post: 06 April 2017 - 04:07 PM

#1 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 16 March 2017 - 08:05 AM

Hey all,
So I've been developing a program for some months to help me with my work as a sysadmin maintaining and setting up computers. I'm wondering if anyone has any recommendations for an easy way to move files using C++ and/or .NET (I assume .NET will be much easier but solution will obviously incorporate both if using .NET extensions)? To be more specific: I have to spend a lot of time sending patch files and other drivers packages to people's computers and I'm wondering if there's a way I can use the hostname or the IP to send things out. (I can open start and do \\XXXXXX\ and access their computer)

All of the computers are on the same windows network so any of the built in windows functions should work. I can directly connect to these computers using administrative C$ if that helps at all.

Appreciate it, in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: Need Recommendations for an Easy Way to Move Files Using .NET/C++

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,845
  • Joined: 12-June 08

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 16 March 2017 - 08:14 AM

Why not have the files on a network accessible shared drive. Keep the latest ones and have folk either use those directly or remote in and run them?
Was This Post Helpful? 0
  • +
  • -

#3 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 16 March 2017 - 09:11 AM

Well I do that.. but I don't like running files through the network as it tends to be slow. But yes the idea is to use a common share drive to move them out. What I'd like to do is be able to select a set of files (as every computer requires a different combination of drivers/software that we use) and push a button... then have the program essentially do the heavy lifting of sending the files out. I don't even care if my computer is sending the files out but I would prefer to invoke a file transfer from a fileserver to the computer in question.

Also, to be a little more clear, when I say: "I don't like running files through the network" I mean lets say I'm installing a lexmark driver on a computer.. I always transfer the .exe and any source files FIRST to the computer locally then run the installer because I've had a ton of installs go wrong trying to run the installer THROUGH the network

Thanks Modi.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,845
  • Joined: 12-June 08

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 16 March 2017 - 09:12 AM

Okay.. assuming security is a non-issue - .NET has 'FileStream' which can move a file from one folder to another including across network drives.
Was This Post Helpful? 0
  • +
  • -

#5 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5890
  • View blog
  • Posts: 20,101
  • Joined: 05-May 12

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 16 March 2017 - 01:02 PM

How much of a budget does your department have? There many applications that already exist to do this kind of configuration managment. All you need to do is setup machine profiles and optionally provide machine names or let it detect the appropriate profile. If you are a Microsoft shop, ask your TEAM about SCCM. If you have contracts with CA, they also have an equivalent suite.

But if you really just want to roll your own, plain old file copies will work assuming you have permissions.
Was This Post Helpful? 0
  • +
  • -

#6 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 17 March 2017 - 10:42 AM

View Postmodi123_1, on 16 March 2017 - 09:12 AM, said:

Okay.. assuming security is a non-issue - .NET has 'FileStream' which can move a file from one folder to another including across network drives.


I would prefer to have decent security; however, none of the files I would be transferring are private. I was hoping that I could just use C++/.NET to invoke the built in windows transfer functions... does that really compromise security?

I don't need to encrypt these files but I also don't want what I'm doing to compromise the overall security of the systems.
Was This Post Helpful? 0
  • +
  • -

#7 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 17 March 2017 - 11:03 AM

View PostSkydiver, on 16 March 2017 - 01:02 PM, said:

How much of a budget does your department have? There many applications that already exist to do this kind of configuration managment. All you need to do is setup machine profiles and optionally provide machine names or let it detect the appropriate profile. If you are a Microsoft shop, ask your TEAM about SCCM. If you have contracts with CA, they also have an equivalent suite.

But if you really just want to roll your own, plain old file copies will work assuming you have permissions.


Yeah I hear you there's definitely applications for this but I want to write my own because it'll only have exactly what I need and I've already been working on this program for months. This is only one feature of the program and it's to send files to computers before I work on them.

As far as budget is concerned.. there is no budget.. I'm developing it on my own lol.. it's to save my own @55 time haha
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,845
  • Joined: 12-June 08

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 17 March 2017 - 11:09 AM

When I say security I mean in network security. I have a log mover app that dumps a few different apps logs from their app server locations into a storage drive. Both are locked down, but my mover runs as an account that has unique access to one and the other.

Certainly no reason even the base streamreader/writer wouldn't work either. A networked file path is just as good as a local folder.
Was This Post Helpful? 0
  • +
  • -

#9 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 17 March 2017 - 11:14 AM

So when you say "the base streamwriter" .. is there a library that you could recommend for this? If you give me a few libraries to research I can probably take it from there.

Thanks Modi
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,845
  • Joined: 12-June 08

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 17 March 2017 - 11:21 AM

.NET has namespace called 'streamwriter'.. and 'streamreader'.. and 'filestream'.
Was This Post Helpful? 1
  • +
  • -

#11 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 21 March 2017 - 02:08 PM

Hmm, these seem to be more suited for writing to files. I've used the Fstream in and out before and I don't necessarily think it's quite what I'm looking for. Actually, I think I should look into invoking a PS script from my program instead of trying to code something that will move files for me.

So I've got a bunch of drivers and applications on a shared network drive \\xxx.xxx.xxx.xxx\xxx\ and lets say I want to code some checkboxes and button, you select the checkboxes in C++ and based on that perhaps either select from a premade set of Powershell scripts or create a PS script on the fly to invoke the transfer.

I'm not sure the Fstream commands are exactly what I'm looking for.. because I'm not really outputting from the program itself. Rather, using the program to invoke the built in windows system functions for file transfers inside the network.

I know this is confusing so I'll probably leave it at that I was really just looking for quick way to do this but for that I'll need PS. I just wasnt sure if there was a nice library for moving files in Windows that I didn't know about (probably no).

I appreciate the help anyway though Modi.
Was This Post Helpful? 0
  • +
  • -

#12 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,845
  • Joined: 12-June 08

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 21 March 2017 - 02:12 PM

Okely dokely.. All of those are pretty easy "read one file's bytes into a stream then write the bytes to another location". Sure.. powershell can do the same.
Was This Post Helpful? 1
  • +
  • -

#13 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 22 March 2017 - 08:28 AM

So here we go
PS command:

Move-Item

Now I just need to figure out how to move to another computer

Move-Item c:\Move\Move.txt C:\Move2\

I wonder if I could do something like:

Move-Item \\xxx.xxx.xxx.xxx\Move\Move.txt \\xxx.xxx.xxx.xxy\Move2

So the idea is to make a PS script then invoke the script(s) using my C++ program... that way I don't have to re-invent the wheel per-se
Was This Post Helpful? 0
  • +
  • -

#14 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 22 March 2017 - 08:59 AM

Copy-Item actually where it's at.

Copy-Item \\xxx.xxx.xxx.xxx\ \\xxx.xxx.xxx.xxx\ ... that works

Now just need to have my program create a PS script on the fly using the destination IP...

So I'm thinking some type of fstream command to generate a PS script then immediatly run it??

Thoughts?
Was This Post Helpful? 0
  • +
  • -

#15 Sam Hobbs  Icon User is offline

  • D.I.C Head

Reputation: 11
  • View blog
  • Posts: 50
  • Joined: 01-April 17

Re: Need Recommendations for an Easy Way to Move Files Using .NET/C++

Posted 06 April 2017 - 01:01 PM

Well let's look at the System.IO Namespace. There is a Directory class; did you see that?
Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2