How to delete a folder and replace with a new one on client pc

(imported topic written by SystemAdmin)

H new to BigFix and need to create/modify a fixlet which would allow us to delete and replace a folder on our client computers. What would be the easiest way?

Thanks

(imported comment written by jessewk)

You should just use the DOS commands. For example:

waithidden mkdir -p “c:\path\to\create”

waithidden rmdir /S /Q “c:\path\to\delete”

Another option if you are more comfortable with a different scripting language like VB is to write out the VB script in the action and then execute the script.

(imported comment written by SystemAdmin)

Thanks, I tried that with no luck. Not sure, but am I supposed to delete everything out of the action list for the fixlet or just add this instead of something else. Here is what I have, I was using the software deployment wizard to try and copy a folder with files into a location. Then the users would open there program with the new files.

download http://S-NA-04:52311/Uploads/f1081fc22e6d008e91b749316442a7384c36b6db/Utility.tmp

continue if {(size of it = 19881210 AND sha1 of it = “f1081fc22e6d008e91b749316442a7384c36b6db”) of file “Utility.tmp” of folder “__Download”}

extract Utility.tmp

waithidden rmdir /S /Q “c:\Program Files\TEST\Utility”

This was to try and delete the folder, and then I was going to mess with copying once this was working.

(imported comment written by arnaud91)

Hi jjjkmoore,

If you are using latest version of BES Platform (7.2.5.22), you can use new action script commands “Folder Create” and “Folder Delete”.

Then you can use a piece of vbscript to copy all files to the new folder.

I am assuming that the “Utility” folder only contains files, no sub folders.

This would be something like

download http:
//S-NA-04:52311/Uploads/f1081fc22e6d008e91b749316442a7384c36b6db/Utility.tmp 

continue 

if 
{(size of it = 19881210 AND sha1 of it = 
"f1081fc22e6d008e91b749316442a7384c36b6db") of file 
"Utility.tmp" of folder 
"__Download"
}   extract Utility.tmp   Folder Delete 
"c:\Program Files\TEST\Utility" Folder Create 
"c:\Program Files\TEST\Utility"   createfile until EndOfVbScript   Set fso = CreateObject(
"Scripting.FileSystemObject")   Set sourceFolder = fso.GetFolder(
"{pathname of client folder of current site}\__Download")   Set destFolder = fso.GetFolder(
"c:\Program Files\TEST\Utility")   Set sourceFiles = sourceFolder.Files For each file In sourceFiles If (fso.FileExists(destFolder & 
"\" & file.Name) = false) Then Call file.Copy(destFolder  & 
"\" & file.Name) End If Next   EndOfVbScript   move __createfile 
"script.vbs"   waithidden 
"wscript.exe" 
"{pathname of client folder of current site}\script.vbs"

Arnaud

(imported comment written by SystemAdmin)

Thanks,

That did the trick!! Appreciate the help.

(imported comment written by anandguptamaurya91)

Hi Arnaud,

Thanks dear. You are such a gra8 persion.