Connect Direct script to "copy" file from source directory to destination directory - file-transfer

I am trying to write a script that takes a file from a specified location and copies it to the destination folder.
I currently have have the following with moves the file, but i need it to copy instead:
NT_JOB CCD1222
RUN THURSDAY
DELAYSUB 11:00
AGENT atl_stsprd01
USER connectd
ARGS source-file.txt +
W1222 +
CD.PRDCL.LNX +
"\\path\to\source\folder\" +
W99999_UNIX.properties +
/path/to/destination/folder/ +
destination-file.txt +
binary
EXITCODE 0 SUCCESS
CMDNAME \data\scripts\filetransfer.bat
RESOURCE ADD(1, DRES)
ENDJOB
What do i need to take the above and make it copy the file over to the destination folder instead!?

Related

Is it possible to load Files in tests on remote CI/CD server? [BitBucket Pipeline]

I'm trying to run a test for resizing images. To do that I have an Image that I load into a File.
This works locally (in IDE and via terminal) but fails in BitBucket's pipeline.
File structure:
Code that loads the image:
String rootDir = Directory.current.path;
imagePath = rootDir + '/test/assets/test_image_gradient_black_white_3000x4000.png';
File myFile = File(filePath);
This works locally, but when run in Bitbucket's pipeline the "current path" returned "does not exist".
Error message:
00:03 +24 -4: /opt/atlassian/pipelines/agent/build/my_repository/test/image_utils_test/image_utils_test.dart: given 3000x4000 pixel file - resize with half width - verify resize and aspect ratio kept [E]
FileSystemException: Cannot open file, path = '/opt/atlassian/pipelines/agent/build/test/assets/test_image_gradient_black_white_3000x4000.png' (OS Error: No such file or directory, errno = 2)
Is it possible to load files in CI?
The path was actually wrong.
When you right click a test in android studio and select run it is run from that path.
When you run it from the terminal you have to supply the full path of your file from where you are currently standing.
Directory.current.path always returns the project root path, and since my test was in a separate module I had to add the path manually.
This should only be done if we are not already in the my_repository module, otherwise we will add the path twice and we would not be able to run the tests from the IDE instead.
This is how I calculate what to add to the string depending on where the test was executed.
String get testRootDir {
String rootDir = Directory.current.path;
String testDir =
rootDir.contains('/my_repository')
? rootDir + '/test'
: rootDir + '/my_repository/test';
return testDir;
}
...
...
final String assetPath = testRootDir + 'assets/test_image_gradient_black_white_3000x4000.png';

How do I update ESXi 6.5 patch using ESXCLI in PowerShell

Trying to update ESXi 6.5 Patch using ESXiCLI within powershell. My path is pointing to a subfolder in datastore called MasterImages.
This is the the path name
/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip
Commands being executed:
$argsInstall = $esxcli.software.profile.update.createargs()
$argsInstall.depot = $patchfilepath
$esxcli.software.vib.update.Invoke($argsInstall)
Below is the error received:
Message: EsxCLI.CLIFault.summary;
InnerText: [MetadataDownloadError] Could not download from depot at
zip:/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip?index.xml, skipping
(('zip:/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip?index.xml', '', "Error extracting index.xml from
/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip: [Errno 2] No such file or directory:
'/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip'")) url =
zip:/vmfs/volumes/MasterImages/Patches/ESXi650-20210704001/ESXi650-20210704001.zip?index.xml Please refer to the log file for more
details.EsxCLI.CLIFault.summary
At line:176 char:5
+ $esxcli.software.vib.update.Invoke($argsInstall)}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], MethodFault
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault
I was able to make an ESX7.0.1 update using $esxcli.software.vib.update.Invoke($argsInstall) but with 6.5 this also returns an error "not able to download from depot".
Assuming you are using the absolute path to the zipped file, please use the datastore UUID instead of the name
https://kb.vmware.com/s/article/2015834

Word-AddIn (VSTO) doesn't get the filepath from local OneDrive Folder

I'm trying to develop an Word-AddIn where I can upload a file, or where I could make changes to the file itself. I can do that with any File on the Local NTFS Windows Filesystem. But when a File is located to any "OneDrive"-Folder it won't work, as the file-Document path starts with:
https://companyname-my.sharepoint.com/personal/name_whatever/Documents
according to the return values of:
var doc = Globals.ThisAddIn.Application.ActiveDocument;
MessageBox.Show("Document Name : " + doc.Name);
MessageBox.Show("Document Full Name : " + doc.FullName);
MessageBox.Show("Document Path : " + doc.Path);
rather than expected to be:
C:\Users\myname\OneDrive-My_Company_Name\Documents
So basically the local folder is not callable. So does anybody has already faced this kind of issue?
You can use the Save or SaveAs methods of the Document to save the document on the local folder.

Renaming S3 files creates temp folders

I am trying to rename the S3 files which basically
copy to target + delete source
But in my case I am able to copy target but not able to delete source properly .
All directory structure remains same without any file ..
also it creates temp files in the main directory .
Do I have to explicitly delete it after renaming ?
Here is my code which renames the files
I have subfolders insode the folder.
val file = fs.globStatus(new Path(outputFileURL + "/*/*"))
for (urlStatus <- file) {
val DataPartitionName = urlStatus.getPath.toString.split("=")(1).split("\\/")(0).toString
val finalFileName = finalPrefix + DataPartitionName + "." + intFileCounter + "." + fileVersion + currentTime + fileExtention
val dest = new Path(mainFileURL + "/" + finalFileName)
fs.rename(urlStatus.getPath, dest)
intFileCounter += 1
}
If you check apache hadoop rename documentation, it says
The core operation of rename()—moving one entry in the filesystem to another ..
So its just moving the files and not renaming . More detail on the link above.
So I guess you will have to explicitly delete the folder name after renaming is complete
Instead of renaming the files only, you could rename the folder as well. That would not require you to explicitly delete the folder name.

Error Running Bulk Metric create script in command manager Microstrategy

I'm trying to run the script below in the command manager, and I'm getting the error messages below. The script is supposed to bulk create a bunch of metrics from facts in another folder. Can someone please tell me what I'm missing. I'm new to running scripts in command manager.
Script:
//list all metrics in the project
String sProjectName = "ProjectName";
String sFactFolder = "\Schema Objects\Facts\FolderName";
String sMetricFolder = "\Public Objects\Metrics\BulkTest";
ResultSet oFacts = executeCapture("LIST ALL FACTS IN FOLDER '" + sFactFolder + "' FOR PROJECT '" + sProjectName + "';");
oFacts.moveFirst();
while (!oFacts.isEof() )
{
//get name and path of this metric to list properties
String sFactName = oFacts.getFieldValueString(DisplayPropertyEnum.NAME);
//get properties of each metric
EXECUTE("CREATE METRIC "" + sFactName + "" IN FOLDER "" + sMetricFolder + "" EXPRESSION 'sum([" + sFactName + "])' ON PROJECT "" + sProjectName + "";");
oFacts.moveNext();
}
Errors:
Syntax error at line '2', column '4'. Expected: ADD, ALTER, APPLY, APPEND, ACTIVATE, BULKSAVEBEGINS, BULKSAVEENDS, CLEAR, CONNECT, CREATE, DEACTIVATE, DELETE, DISCONNECT, DISABLE, ENABLE, GET, GRANT, IDLE, IMPORT, INVALIDATE, KILL, LIST, LOAD, LOG, PUBLISH, PURGE, REGISTER, REMOVE, REPLACE, RESTART, RESUME, REVOKE, RUN, SEND, SET, START, STOP, TAKE OWNERSHIP, TRIGGER, UNLOAD, UNLOCK, UNREGISTER, UPDATE, VALIDATE, RESET, LOCK, EXECUTE, EXPIRE
Task(s) execution completed with errors.
Execution Time: 00:00:00
If you’re running that directly in Command Manager, it will fail, because it’s Java. You’ll need to create a procedure with that code, and call the procedure from Command Manager. The documentation should cover that process I think.
Use Procedure and type (do not paste the code) that code in there.
Also, change the Execute command as below.
EXECUTE("CREATE METRIC '" + sFactName +
"' IN FOLDER '" + sMetricFolder +
"' EXPRESSION 'sum([" + sFactName + "])' ON PROJECT '" + sProjectName + "';");
oFacts.moveNext();
It works.