copy

About File permissions in C#

While creating a file synchronization program in C# I tryed to make a method 'copy' from LocalFileItem class that uses sing System.IO.File.Copy(destination.Path, Path, true) where Path is a string. After executing this code with destination.Path = "C:\Test2" and this.Path = "C:\Test\F1.txt" I get an exception saying that I do not have th...

SQL 2005 copy single column between databases

Hi, I'm still fairly new to T-SQL and SQL 2005. I need to import a column of integers from a table in database1 to a identical table (only missing the column I need) in database2. Both are sql 2005 databases. I've tried the built in import command in Server Management Studio but it's forcing me to copy the entire table. This causes error...

Best way to copy the entire contents of a directory in C#

I want to copy the entire contents of a directory from one location to another in C#. There doesn't appear to be a way to do this using System.IO classes without lots of recursion. There is a method in VB that we can use if we add a reference to Microsoft.VisualBasic: new Microsoft.VisualBasic.Devices.Computer(). FileSystem.CopyDi...

What's the fastest way to copy the values and keys from one dictionary into another in C#?

There doesn't seem to be a dictionary.AddRange() method. Does anyone know a better way to copy the items to another dictionary without using a foreach loop. I'm using the System.Collections.Generic.Dictionary. This is for .NET 2.0. ...

Ant OS-specific copy task

I have an Ant script that performs a copy operation using the copy task. It was written for Windows and has a hardcoded C:\ path as the todir argument. I see the exec task has an OS argument, is there a similar way to branch a copy based on OS? ...

force Maven2 to copy dependencies into target/lib

Hi, How do I get my project's runtime dependencies copied into the target/lib folder? As it is right now, after 'mvn clean install' the target folder contains only my project's jar, but none of the runtime depencies. Thanks, Michael ...

Copy boot partition from one disk to another

I'm currently facing a hardware HD problem. Once of my HDs has semi-died. It works, kind of, data is being read, but every now and then it decides to not respond for a while. Windows hangs for a few seconds, and sometimes I get an event in my event log saying that the device didn't respond fast enough, or something to that effect. Now ...

Standard concise way to copy a file in Java?

It has always bothered me that the only way to copy a file in Java involves opening streams, declaring a buffer, reading in one file, looping through it, and writing it out to the other steam. The web is littered with similar, yet still slightly different implementations of this type of solution. Is there a better way that stays within...

How to change slow parametrized inserts into fast bulk copy (even from memory)

I had someting like this in my code (.Net 2.0, MS SQL) SqlConnection connection = new SqlConnection(@"Data Source=localhost;Initial Catalog=DataBase;Integrated Security=True"); connection.Open(); SqlCommand cmdInsert = connection.CreateCommand(); SqlTransaction sqlTran = connection.BeginTransaction(); cmdInsert.Transaction = sq...

Sample sql script to zip and transfer database backup file

I was looking for a sample sql script to zip my database backup file (.bak) and transfer to a remote location. Please share if you have it with you. ...

How to determine when copy finishes in VBScript?

Does anyone know of a method to determine when a file copy completes in VBScript? I'm using the following to copy: set sa = CreateObject("Shell.Application") set zip = sa.NameSpace(saveFile) set Fol = sa.NameSpace(folderToZip) zip.copyHere (Fol.items) ...

Is dd better than cat?

Suppose I want to clone my hard drive (hda) to another drive (hdb) in the same computer. As I see it, there's two easy, rough and do-it-yourself ways: cat /dev/hda > /dev/hdb and dd if=/dev/hda of=/dev/hdb What technical reasons are there to that the latter is often/always said to be better than the former? under no circumstances tr...

LDAP entire subtree copy

Hi, I am actually new to this forum and I kept trying for a few days to find an easy way to copy an entire LDAP subtree to another tree. Since I couldn't find anything useful, i thought of dropping a question here as well. Does anybody know how to do this programatically ? For normal operations like add, remove, search, I've been using ...

How can I copy data records between two instances of an SQLServer database

I need to copy some records from our SQLServer 2005 test server to our live server. It's a flat lookup table, so no foreign keys or other referential integrity to worry about. I could key-in the records again on the live server, but this is tiresome. I could export the test server records and table data in its entirety into an SQL scr...

Can't copy file with appropriate permissions using FileIOPermission

Hello, This snippet works well if I try to write in a user directory but as soon as I try to write in Program Files, it just executes silently and the file has not been copied (no exception). If I try to copy the file in C:\ or in C:\Windows I catch an UnauthorizedAccessException. Do you know another way to get the permissions to writ...

What is the difference between a deep copy and a shallow copy?

What is the difference between a deep copy and a shallow copy? ...

How do I copy files using Windows Batch?

I have a directory with several subdirectories with files. How can I copy all files in the subdirectories to a new location? Edit: I do not want to copy the directories, just the files... As this is still on XP, I chose the below solution: for /D %S IN ("src\*.*") DO @COPY "%S\" "dest\" Thanks! ...

How do I create a copy of an object in PHP?

It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: <?php class A { public $b; } function set_b($obj) { $obj->b = "after"; } $a = new A(); $a->b = "before"; $c = $a; //i would especially expect this to create a cop...

How to copy file from linux to windows server using c

I have to create a C program which will run on Linux server. It will take information from Oracle database, create a local file and then copy that file to Windows server. I know how to create a local file on Linux server. But what is the way to copy it to windows server from C? ...

Can I show file copy progress using FileInfo.CopyTo() in .NET?

I've created a copy utility in c# (.NET 2.0 Framework) that copies files, directories and recursive sub directories etc. The program has a GUI that shows the current file being copied, the current file number (sequence), the total number of files to be copied and the percentage completed for the copy operations. There is also a progress ...