LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Command line log for xcopy

Solved!
Go to solution

I am trying to log the result of running the xcopy by command line, but not successful.

 

Any suggestion?

Please rename the attached xcopy.vi to xcopy.exe

Download All
0 Kudos
Message 1 of 12
(13,829 Views)
Solution
Accepted by alex.
This site may be helpfull. http://www.labnol.org/software/tutorials/copy-dos-command-line-output-clipboard-clip-exe/2506/. As an old DOS person I use the redirect operator. There's also an Invoke Node method for the LabVIEW Application class called Clipboard >> Read from Clipboard and Clipboard >> Write to Clipboard. 


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 2 of 12
(13,817 Views)

For some reason, the command doesn't run properly if "Wait Until Completion" is set to True.  If you use this:

 

 cmd /c "XCopy /Y /E /F d:\test3\*.* d:\test4\" > c:\test.txt

 

as your command line it will create c:\test.txt which will have the info you are looking for.

 

Is tehre a reason you are not doing this directly in LabVIEW?

0 Kudos
Message 3 of 12
(13,806 Views)

It appears that you're not getting anything on the standard output when you run the xcopy command like that. Even preceding the command with "cmd /c" doesn't do anything. In addition to the above suggestion you can try the technique shown in this example.

 

 

EDIT: Ah, good catch with the wait until completion. Also, good question about why this is not being done using LabVIEW functions. 

Message Edited by smercurio_fc on 12-09-2008 09:33 AM
Message 4 of 12
(13,805 Views)

I guess this labview function should do the jobSmiley Very Happy

Copy Function

Installed With: Base Package

Copies the file or directory that you specify in source path to the location that you specify in target path. If you copy a directory, this function copies all its contents recursively to the new location. This function does not work for files inside an LLB.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 5 of 12
(13,794 Views)
There's one issue with using Copy by itself.  If you specify a directory, LV also copies the directory itself.  So, in this case, you would get d:\test4\test3 instead of the files and directories in test3 being copied into test4.  I think this behavior is bad, as it is just as easy to wire in d:\test4\test3 to the destination directory.  The alternative is to use the Recursive FIle List to get all the files and copy them one at a time or use the List Folder to get the list of filenames in the root directory and the list of subdirectories, then use copy to copy the files and subdirectories.
0 Kudos
Message 6 of 12
(13,789 Views)

That is not correct Matthew. In this example I copy the dir C:\dell\contact to the new dir c:\test1. If C:\dell\conntact have subdirs they will also be copied 

 

 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 12
(13,782 Views)

I wasn't saying the subdirectories wouldn't be copied.  What I am saying is that there is a contact directory created in c:\test1 (assuming c:\test1 exists).  So you get c:\test1\contact.  If c:\test1 doesn't exist, then it doesn't create c:\test1\contact.  The more intuitive way (at least to me) is to behave the same way and never create contact unless I specify that's where it should go.  So, you get two different behaviors.  The only way to correct for this is to do it yourself by listing the folder and copying the files individually.

 

Run your VI twice in a row starting with c:\test1 not existing.

0 Kudos
Message 8 of 12
(13,770 Views)

Maybe it is time for me to go home. The time is 18:30 her e in Norway. But anyway referring to my first example. If the dir c:\test1 do not exist it will be created, and the content of c:\dell\contact will be copied into c:\test1. But if the dir c:\test1 exists I will get an error (duplicate dir). On the other hand. if I want to copy the content in c:\dell\contact to c:\test1\contact I will get an error if c:\test1 does not exist

This was tested in 7.0

Message Edited by t06afre on 12-09-2008 11:56 AM


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 9 of 12
(13,759 Views)
In the current version of LabVIEW, you can specify the files to be overwritten, so you won't get the Duplicate Path error.
0 Kudos
Message 10 of 12
(13,753 Views)