I want to copy one directory from one location to another but while copying I am getting an error message:
"Could not complete operation on some files and directories. See the Data property of the exception for more details." i don't know what is the problem
I tried:
Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(FolderBrowserDialog1.SelectedPath, System.IO.Path.Combine(curDir, filename.Name))
and
My.Computer.FileSystem.CopyDirectory(FolderBrowserDialog1.SelectedPath, System.IO.Path.Combine(curDir, filename.Name))
But I am still getting same message .
Any pointers on how to get around this?
Thanks.
You could try using
Process.StartInfo.Filename = "xcopy"
Process.StartInfo.Arguments = String.Format("{0} {1} {2}", sourcedir, destdir, xcopyflags)
Process.Start()
If you're not sure of the flags or usage you can open a command prompt and type
xcopy /?
Related
I am trying to read a set of files via a loop
for (i in 1:81){
Y[i,1:1001] = t(read.table(sprintf('/Users/pitman/Desktop/Desktop/Desktop/DataSets/code_Yingjie/RDsystem/%d_1000.dat',ss[i])))
}
After some processing I get the error message
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file '/Users/ebp/Desktop/Desktop/Desktop/DataSets/code/RDsystem/60_1000.dat': No such file or directory
The first 59 files appear to have been read. Why balk at file 60?
When I repeat this command (after trying some other things) I can change the file number at which the error appears -- 34 or 51 or 60...
Any pointers appreciated
Using Python 3.8.1 code, I unzipped the distribution of postgresql12 in a specific folder of root C, inside the code it creates two other folders, data and log. In the code I write the following line to set up a first database:
subP = subprocess.run([link_initdb, "-U NewDataBase", "-A AlphaBeta", "-E utf8", "-D C:\\Database\\pgsql\\data"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8")
But I get the following error message:
ubP.stderr: initdb: error: could not create directory " C:": Invalid argument
I don't know what I'm wrong!
For whatever reason there should be no space between -D and the filename.
To solve it you can use:
subP = subprocess.run([
link_initdb,
"-U postgres",
"-A password",
"-E utf8",
"--pgdata=C:\Database\pgsql\data",
],
shell=True,
)
I have a test script I'm running that generates some errors,shown below, I expect these errors. Is there anyway I can prevent them from showing on the screen however? I use the
$ write sys$output
to display if there is an expected error.
I tried to use
$ DEFINE SYS$ERROR ERROR.LOG
but this then changed my entire error output log to this, if this is the correct way to handle it can I unset this at the end of my script somehow?
[error example]
%DCL-E-OPENIN, error opening TEST$DISK:[AAA]NOTTHERE.TXT; as input
-RMS-E-FNF, file not found
%DCL-E-OPENIN, error opening TEST$DISK:[AAA]NOTTHERE.TXT; as input
-RMS-E-FNF, file not found
%DCL-W-UNDFIL, file has not been opened by DCL - check logical name
DEFINE/USER creates a logical name that disappears when the next image exits.
So if you use that just before a command just to protect that command, then fine.
Otherwise I would prefer SET MESSAGE to control the output.
And of course yoy want to grab $STATUS and verify it after the command for success or for the expected error, reporting any unexpected error.
Better still... if you expect certain error conditions to occur,
then why not test for them?
For example:
$ file = F$SEARCH("TEST$DISK:[AAA]NOTTHERE.TXT")
$ IF file.NES."" THEN TYPE 'file'
Cheers,
Hein
To suppress Error message inside a script. try this command
$ DEFINE/USER SYS$ERROR NL:
NL: is a null device, so you don`t see any error messages displayed on your terminal.
good luck
This works interactively and in batch.
$ SET MESSAGE /NOTEXT /NOSEV /NOFAC /NOID
$ <DCL_Command>
$ SET MESSAGE /TEXT /SEV /FAC/ ID
I'm trying to run dos commands within vb.net program and capture output. I have the following code:
Dim CMDServer As Diagnostics.ProcessStartInfo
Dim CMDReply As Diagnostics.Process
CMDServer = New Diagnostics.ProcessStartInfo
CMDServer.FileName = "cmd.exe"
CMDServer.UseShellExecute = False
CMDServer.RedirectStandardOutput = True
CMDServer.CreateNoWindow = True
CMDServer.Arguments = "/C " + command
CMDReply = Process.Start(CMDServer)
Dim Reply As String = CMDReply.StandardOutput.ReadToEnd()
The code runs successfully if command is a valid dos command, and I get the output in Reply. If the command have no output ( eg: cd\ ) Reply is null. The problem is Reply is null even when the command is invalid. How to capture errors like "command is not recognized as an internal or external command...", "The system cannot find the path specified.." etc.. Please help me. Thanks..
Error messages come in a different output stream called StandardError. Just use a StreamReader or read it directly. Of course, the RedirectStandardError-Property of your ProcessStartInfo instance must be set to True.
Also, there is a ExitCode-Property which returns the ExitCode of the program after it has finished. 0 means 'successful'. Other error codes can be found in the MSDN Documentation. Here is a list of the common exit codes. For example, 2 means The system cannot find the file specified..
Errors are probably output on CMDReply.StandardError, not CMDReply.StandardOutput; try reading it, too. (And set CMDServer.RedirectStandardError to True as well.)
I want to delete an entry with wmic but i always get an error, i saw DELETE command is a valid verb of STARTUP. what i am doing wrong?
thnx
wmic:root\cli>/node:'pc-test' startup where name="TwonkyServer" DELETE
Delete '\\pc-test\ROOT\CIMV2:Win32_StartupCommand.Command="C:\\PROGRA~1\\Twonky\\TWONKY~1\\TWONKY~4.EXE ",Location="Common Startup",Name="TwonkyServer",User="Public"' (Y/N/?)? y
Deleting instance \\pc-test\ROOT\CIMV2:Win32_StartupCommand.Command="C:\\PROGRA~1\\Twonky\\TWONKY~1\\TWONKY~4.EXE ",Location="Common Startup",Name="TwonkyServer",User="Public"
ERROR:
Description = Provider is not capable of the attempted operation
I don't know if you can achieve it through WMI console, but through VBS try providing a priviliged moniker string in reference to the system:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa389292(v=vs.85).aspx
You Can Get The Entry By This Command:
wmic startup get Location | findstr /B /C:"TwonkyServer"
Then Delete It From Registry
Reg delete [{/v ValueName | /ve | /va}] [/f]
More Help At Reg Delete At:
https://technet.microsoft.com/en-us/library/cc742145.aspx