Delete files in the drop location - azure

I am trying to delete the folder with name "repro" and its contents in my build drop location. I have configured my delete files steps as below
Source Folder: $(BuildDropLocation)\$(BuildNumber)\CTrest\lime
Contents:
**/repro/*
repro folder resides here
$(BuildDropLocation)\$(BuildNumber)\CTrest\lime\version\package\code**repro**..
Is there something that I am missing here?

Here is the doc for the command: Delete Files task. Examples of contents:
**/temp/* deletes all files in any sub-folder named temp.
**/temp* deletes any file or folder with a name that begins with temp.
I think, **/repro* will be more suitable in your case.

Related

Azure DevOps Copy Task Failing for DLL with same name

I have maybe one of the simplest releases failing.
I am using the default copy files task to copy everything from the artificat (source/azure repo) to the target (a physical server in this case). On each copy the target is cleaned; all files are deleted from target.
COPY TASK
Source Folder: $(System.DefaultWorkingDirectory)/_DEV/
Contents: */ (I tried "Contents: **" as well)
E:\DEV\
Clean Target Folder (checked)
Overwrite (checked)
Flatten Folders (unchecked)
Preserve Target Timestamp (checked)
There are 2 dlls named the same but one file is in the root and another is in a subfolder. It appears that the sub folder gets updated with the root version of the file. I know this because of the different file size. I have confirmed that the repo has 2 different versions of the dll by cloning it to my local.
Root Folder - x.dll (v1) (1300KB)
Subfolder - x.dll (v2) (1400KB)
So on releases...
If v1 is in the root and v2 is in the subfolder, v1 is copied to the root and subfolder.
If v2 is in the root folder, that gets copied to the root and to the sub folder.
If v1 is deleted in the root folder and v2 is in the subfolder, v2 is copied to the subfolder. No file in the root folder.
I tried using a text file with the same name and different file size and that seems to work. Its seems to be only dlls causing the problem.
I have no idea why the root folder file has presidence over the subfolder version.

Renaming the folder zip file extracts to

Might just be an edge case but I extracted a zip file to a directory using the zip file module. When extracting, zip file names the directory it extracts to.
If there is a way I get to specify the name of the folder Zip file creates to extract the files to? I am hitting an error because I am using the same folder zipped up to test zip file and it keeps using the old folder name which already exists so it throws an error. Here is my code:
orginalFolderName = jobFolder + name
with zipfile.ZipFile(directory,"r") as zip_ref:
zip_ref.extractall(jobFolder)
os.rename(orginalFolderName, newFoldername)
directory = newFoldername
with zipfile.ZipFile(filepath) as z:
z.extractall(dest_folder)
filepath - Complete path of zipfile
dest_folder - destination folder

Nodejs fs.copyfile not allowed for copy a file to the destination folder

I am trying to copy a file from one location to another so I'm using this:
fs.copyFile('C:\\Users\\Me\\Documents\\myfile.zip', c:\\myfiles
console.log('file was copied successfully!');
});
I can see that the destination folder is readonly so that's why I'm getting this.
How can I change it's status on my windows pc.
I've tried this but nothing is happening and I still get the error:
fs.chmodSync('c:\\myfiles', 0o755);
How can I fix this issue?
You are using Windows, I guest C:\ is your system disk (where you install the Windows).
If you want to write a file to c:\myfiles , it require you Administrator permission (you can try by way: copy and paste a file to the folder, by hand).
Solution:
Option1: Change your folder, ex: D:\myfiles
Option2: Use windows file manager, change your folder permission (everyone read/write)

Creating A Folder In the Temp Folder

I'm trying to create a folder within the temp folder that doesn't have a random name.
Here is how I was trying to create the folder within the temp folder.
if not DirExists(ExpandConstant('{%tmp}\Utilities\SDK')) then
CreateDir(ExpandConstant('{%tmp}\Utilities\SDK'));
Log('Temp\Utilities\SDK Folder Has Been Created.');
I had a look at this thread, but even with the %, unfortunately, it still doesn't create the folder.The script compiles and runs as expected, however the folder doesn't create even though it says it has in the log file, I understand that the log file will say that because its told too, however, if the folder was unable to be created, wouldnt it crash? or return a false if an if statement was present?
With CreateDir() You must create dirs one after the other and not a dir structure at once.
if not DirExists(ExpandConstant('{tmp}\Utilities')) then
CreateDir(ExpandConstant('{tmp}\Utilities'));
if not DirExists(ExpandConstant('{tmp}\Utilities\SDK')) then
CreateDir(ExpandConstant('{tmp}\Utilities\SDK'));
if DirExists(ExpandConstant('{tmp}\Utilities\SDK')) then
Log('Temp\Utilities\SDK Folder Has Been Created.') else
Log('Temp\Utilities\SDK Folder ERROR : NOT Created.');
Inno Setup has a function to create a dir structure at once
function ForceDirectories(Dir: string): Boolean;
Example:
if not DirExists(ExpandConstant('{tmp}\Utilities\SDK')) then
ForceDirectories(ExpandConstant('{tmp}\Utilities\SDK'));
Also keep in mind :
{tmp} all is related to the Inno Setup Temp folder is-XXXXX.tmp
C:\Users\...\AppData\Local\Temp\is-XXXXX.tmp
{%temp} is the users Temp folder
C:\Users\...\AppData\Local\Temp
I think you want the Windows Temp and not the tmp from InnoSetup
{tmp}:
Temporary directory used by Setup or Uninstall. This is not the value of the user's TEMP environment variable. It is a subdirectory of the user's temporary directory which is created by Setup or Uninstall at startup (with a name like "C:\WINDOWS\TEMP\IS-xxxxx.tmp"). All files and subdirectories in this directory are deleted when Setup or Uninstall exits. During Setup, this is primarily useful for extracting files that are to be executed in the [Run] section but aren't needed after the installation.
So I think you want to do somethink like this:
if not DirExists(ExpandConstant('{%temp}\Utilities\SDK')) then
CreateDir(ExpandConstant('{%temp}\Utilities\SDK'));
Log('Temp\Utilities\SDK Folder Has Been Created.');

NodeJS copy directories and contents that don't exist already

I need a function in NodeJS (or an existent one, although I did't find one) that copies a folder to a diferent location but only copies the non existing files in the destination:
Folder to Copy:
-- Folder1
---- Folder1_1
------- File1_1_1
---- Folder1_2
------- File1_2_1
Destination Path has:
-- Folder1
---- Folder1_1
------- File1_1_1
So this method should only copy Folder1.2 and it's contents (File1.2.1) since all the other files are present already.
Does anyone have any idea on how to do this or if there is a module that has a method that does this?
simply use ncp and set the property options.clobber to false, then it wont replace any files already existing.

Resources