Trouble extracting a compressed folder

Hi, I’m having problems with some actionscript that I’ve butchered and need some advice.
I had to modify the actionscript generated by the Software Distribution portal but it’s still pretty basic, the software package consists of 2 files and a folder. The files move across just fine, but the task always fails when extracting the compressed file.

The line in particular is:

Failed extract “C:\3DSMAX\3DSMAX2017\compressedPackageData-201607031556.bftemp” “C:\3DSMAX\3DSMAX2017\Img”

The folder’s name is “Img” before compression, so I would assume that the above string should work. Does anybody have any idea why it’s failing? Does that folder have to exist before extracting? Does “C:\3DSMAX\3DSMAX2017” suffice?

Any help would be appreciated, I’ve included the entire task’s actionscript below.

Completed begin prefetch block 
Completed add prefetch item name=C162548350E862284139CB81C80913ECF4CEF5AF sha1=c162548350e862284139cb81c80913ecf4cef5af size=951 url=SWDProtocol://127.0.0.1:52311/Uploads/C162548350E862284139CB81C80913ECF4CEF5AF/ACTE%203DSMAX2017.lnk.bfswd sha256=ebf15b747b8453a3a24fa89c0cfcd419e26e1bb9c0cdf8a8df62ac3fc6f489cc 
Completed add prefetch item name=62965ABA5B7A3370619A414F68E8D743FE5B354A sha1=62965aba5b7a3370619a414f68e8d743fe5b354a size=27066 url=SWDProtocol://127.0.0.1:52311/Uploads/62965ABA5B7A3370619A414F68E8D743FE5B354A/ACTE%203DSMAX2017.log.bfswd sha256=b59c6facc6c67457cb6a49450511aba3bd09f8a89015b463ffef32b915f4b71e 
Completed add prefetch item name=93B31CF2A247849A4C195322C4F286447CF0AB99 sha1=93b31cf2a247849a4c195322c4f286447cf0ab99 size=4959243304 url=SWDProtocol://127.0.0.1:52311/Uploads/93B31CF2A247849A4C195322C4F286447CF0AB99/compressedPackageData-201607031556.bftemp.bfswd sha256=864c14e27820dd8605191bbe40f80a90e225bf0491f41a71c484ee38c2707de0 
Completed end prefetch block 
Completed // All SWD files will go into a folder in the clients __BESData folder. This folder gets cleared on every restart. 
Completed parameter "baseFolder" = "C:\3DSMAX\3DSMAX2017\" 
Completed // Move files into subfolders and unescape file names 
Completed move "__Download/C162548350E862284139CB81C80913ECF4CEF5AF" "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.lnk" 
Completed move "__Download/62965ABA5B7A3370619A414F68E8D743FE5B354A" "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.log" 
Completed move "__Download/93B31CF2A247849A4C195322C4F286447CF0AB99" "C:\3DSMAX\3DSMAX2017\compressedPackageData-201607031556.bftemp" 
Completed // extract any compressed files 
Failed extract "C:\3DSMAX\3DSMAX2017\compressedPackageData-201607031556.bftemp" "C:\3DSMAX\3DSMAX2017\Img\" 
 dos C:\3DSMAX\3DSMAX2017\Img\setup.exe /qb /I C:\3DSMAX\3DSMAX2017\Img\ACTE 3DSMAX2017.ini

Does the folder “C:\3DSMAX\3DSMAX2017\Img\” exist before you try to extract into it?

Hi Tim

No it didn’t, I should have thought of that. I’ve added a command to create it before it extracts, let’s see how it goes.
Thanks!

Hi Tim, unfortunately it didn’t work.
It failed here again:

extract "C:\3DSMAX\3DSMAX2017\compressedPackageData-201607031556.bftemp" "C:\3DSMAX\3DSMAX2017\Img\" 

I had this batch file running before the move actionscript:

// Ensure that required directory exists and is empty for task
delete cleardir.bat
delete __appendfile

appendfile rd /S /Q "C:\3DSMAX"
appendfile mkdir "C:\3DSMAX\3DSMAX2017\Img"
copy __appendfile cleardir.bat

wait cleardir.bat

Is that extract command wrong at all? I was wondering if it would create a “Img” folder inside the “Img” folder that my batch file created. Do I need to remove the backslash after “Img” to tell it to extract to the folder instead of inside the folder or something?

Appreciate your help.

Okay, I figured that maybe IEM can’t extract files that aren’t in the Program Files (x86)\Bigfix folder so I let it move the folder to “__Download/compressedpackagedata” and extract it there.
This worked fine, but it’s still failing when it tries to move the files:

Completed       extract "compressedPackageData-201607031556.bftemp" "{parameter "baseFolder"}" 
Failed       move "{parameter "baseFolder"}Img" "C:\3DSMAX\3DSMAX2017\Img" 
 move "{parameter "baseFolder"}SMS_SCCM scripts" "C:\3DSMAX\3DSMAX2017\SMS_SCCM scripts" 
 move "{parameter "baseFolder"}Tools" "C:\3DSMAX\3DSMAX2017\Tools" 

I can only narrow it down to having trouble moving folders at this point. Does anybody know what I’m doing wrong? Here are the logs for this part of the action:

At 02:01:05 +1000 - actionsite (http://SRV-25.domain.com.au:52311/cgi-bin/bfgather.exe/actionsite)
   Command succeeded extract "compressedPackageData-201607031556.bftemp" "__Download\" (action:97323)
At 02:01:15 +1000 - 
   Retry error, attempt 9 failed for MoveFile (C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\opsite4\__Download\Img ,C:\3DSMAX\3DSMAX2017\Img)
At 02:01:15 +1000 - actionsite (http://SRV-25.domain.com.au:52311/cgi-bin/bfgather.exe/actionsite)
   Command failed (Move of 'C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\opsite4\__Download\Img' to 'C:\3DSMAX\3DSMAX2017\Img' failed (0 - )) move "__Download\Img" "C:\3DSMAX\3DSMAX2017\Img" (action:97323)
At 02:01:15 +1000 - 
   ActionLogMessage: (action:97323) ending action

For now, I think I’ll move the folders via DOS because I’m sure that’ll work, but I’d love some help with this if possible so I can change it back to how it should be later.

Hi Jake,

Sorry to hear that this is giving you so much grief. I have certainly had some hair-pulling experiences with the __Download directory at times…

The first thing you should do is verify your files are where you think they are.

I see that you are now extracting to the __Download folder again before the move attempt.

I would suggest commenting out the rest of the actionscript so the extract is the last thing it does. Then connect to the target device and browse to the C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\opsite4\__Download directory. Are your files there in the Img subdirectory? Since the move command failed, I suspect you will find something different. If not, we can try something other than move to see if that helps.

That being said, I do often use the method you were first attempting, of extracting to a different directory than the __Download folder. After we get the move working we could revisit the first method as well.

1 Like

Hi Sean

Thanks so much for your reply, I commented out the move commands after extraction and everything completed, AND the files were there!
I guess the move commands after extraction were not written correctly, this is what I have:

 // move "{parameter "baseFolder"}ACTE 3DSMAX2017.lnk" "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.lnk" 
 // move "{parameter "baseFolder"}ACTE 3DSMAX2017.log" "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.log" 
 // move "{parameter "baseFolder"}Img" "C:\3DSMAX\3DSMAX2017\Img" 
 // move "{parameter "baseFolder"}SMS_SCCM scripts" "C:\3DSMAX\3DSMAX2017\SMS_SCCM scripts" 
 // move "{parameter "baseFolder"}Tools" "C:\3DSMAX\3DSMAX2017\Tools" 

Should I change the “{parameter “baseFolder”}” stuff to “C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\opsite4__Download”?

You shouldn’t have to change it to a hardcoded path, it’s not really recommended because the baseFolder parameter gives you the advantage of not having to deal with possible 32 bit / 64 bit differences with C:\Program Files vs C:\Program Files (x86).

But, to your point let’s try using the full path instead of just baseFolder / __Download. You can do that by using the following parameter:

parameter "SiteDownloadPath" = "{pathname of client folder of current site & "\__Download"}"

I left off the trailing slash after Download due to a personal preference, so feel free to put it back if you like. Regardless, this should evaluate to C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\opsite4\__Download

Then uncomment your first move statement for a test and change/add:

// Destination path must exist when using the move command.
if {not exists folder "C:\3DSMAX\3DSMAX2017"}
    folder create "C:\3DSMAX\3DSMAX2017"
endif

// Move will fail if the destination file exists, so delete just in case. Delete calls on non-existent files do not fail, so you don't have to check if it exists beforehand.
delete "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.lnk"

move "{parameter "SiteDownloadPath"}\ACTE 3DSMAX2017.lnk" "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.lnk"

Note that this is why I usually prefer using extract instead of move, because extract will automatically create paths and overwrite files. There’s not all this overhead with creating folders and deleting existing files. But we can get back to that later if you’d like. Let’s try this first.

It isn’t required for the target directory to exist but the trailing backslash MIGHT be confusing it.

It might be worth turning on the EMSG log to see what is going on as a lot of the extra errors go there.

It also might be something to do with the version of the client you are using… so what is it?

Hi Sean

I tried what you suggested and this time it failed at the extract command, so I ran it twice more and it failed before that at the move command each time.:

Completed   parameter "SiteDownloadPath" = "{pathname of client folder of current site & "\__Download"}" 
Completed   // Destination path must exist when using the move command. 
Completed   if {not exists folder "C:\3DSMAX\3DSMAX2017"} 
Completed   folder create "C:\3DSMAX\3DSMAX2017" 
Completed   endif 
Completed   // Move files into subfolders and unescape file names 
Failed   move "__Download\C162548350E862284139CB81C80913ECF4CEF5AF" "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.lnk" 

My actionscript is now free of hardcoded paths, shall I try changing back to “baseFolder” and extracting from “__Download” directly to the “C:\3DSMAX\3DSMAX2017” folder as generated by the default again? Here’s my full actionscript:

begin prefetch block
  add prefetch item name=C162548350E862284139CB81C80913ECF4CEF5AF sha1=c162548350e862284139cb81c80913ecf4cef5af size=951 url=SWDProtocol://127.0.0.1:52311/Uploads/C162548350E862284139CB81C80913ECF4CEF5AF/ACTE%203DSMAX2017.lnk.bfswd sha256=ebf15b747b8453a3a24fa89c0cfcd419e26e1bb9c0cdf8a8df62ac3fc6f489cc
  add prefetch item name=62965ABA5B7A3370619A414F68E8D743FE5B354A sha1=62965aba5b7a3370619a414f68e8d743fe5b354a size=27066 url=SWDProtocol://127.0.0.1:52311/Uploads/62965ABA5B7A3370619A414F68E8D743FE5B354A/ACTE%203DSMAX2017.log.bfswd sha256=b59c6facc6c67457cb6a49450511aba3bd09f8a89015b463ffef32b915f4b71e
  add prefetch item name=93B31CF2A247849A4C195322C4F286447CF0AB99 sha1=93b31cf2a247849a4c195322c4f286447cf0ab99 size=4959243304 url=SWDProtocol://127.0.0.1:52311/Uploads/93B31CF2A247849A4C195322C4F286447CF0AB99/compressedPackageData-201607031556.bftemp.bfswd sha256=864c14e27820dd8605191bbe40f80a90e225bf0491f41a71c484ee38c2707de0
end prefetch block

delete cleardir.bat
delete __appendfile

appendfile rd /S /Q "C:\3DSMAX"
copy __appendfile cleardir.bat

wait cleardir.bat

// All SWD files will go into a folder in the clients __BESData folder. This folder gets cleared on every restart.
parameter "SiteDownloadPath" = "{pathname of client folder of current site & "\__Download"}"

// Destination path must exist when using the move command.
if {not exists folder "C:\3DSMAX\3DSMAX2017"}
	folder create "C:\3DSMAX\3DSMAX2017"
endif

// Move files into subfolders and unescape file names
move "__Download\C162548350E862284139CB81C80913ECF4CEF5AF" "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.lnk" 
move "__Download\62965ABA5B7A3370619A414F68E8D743FE5B354A" "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.log" 
move "__Download\93B31CF2A247849A4C195322C4F286447CF0AB99" "__Download/compressedPackageData-201607031556.bftemp" 

// extract any compressed files
extract "compressedPackageData-201607031556.bftemp" "{parameter "SiteDownloadPath"}"

move "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.lnk" "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.lnk"
move "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.log" "C:\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.log"
move "{parameter "SiteDownloadPath"}Img" "C:\3DSMAX\3DSMAX2017\Img"
move "{parameter "SiteDownloadPath"}SMS_SCCM scripts" "C:\3DSMAX\3DSMAX2017\SMS_SCCM scripts"
move "{parameter "SiteDownloadPath"}Tools" "C:\3DSMAX\3DSMAX2017\Tools"

dos C:\3DSMAX\3DSMAX2017\Img\setup.exe /qb /I C:\3DSMAX\3DSMAX2017\Img\ACTE 3DSMAX2017.ini

Alan, I’m on 9.5.2.56 right now. I can try turning on those logs as suggested, is it explicit about why move/extract commands might fail?

Thanks guys!

Hi,

So a couple notes:

Paths

parameter "SiteDownloadPath" = "{pathname of client folder of current site & "\__Download"}"

Does not have a trailing slash so when you do:

move "__Download\C162548350E862284139CB81C80913ECF4CEF5AF" "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.lnk"

You are copying the file to

__BESData\MySite\__DownloadACTE 3dDMAX2017.lnk

When you’re actually trying to copy it into the download folder.

So first, you should change the parameter sitedownloadpath to:

parameter "SiteDownloadPath" = "{pathname of client folder of current site & "\__Download\"}"

Or you need to add a \ to your move paths:

move "__Download\62965ABA5B7A3370619A414F68E8D743FE5B354A" "{parameter "SiteDownloadPath"}\ACTE 3DSMAX2017.log" 

Move / Delete

Next, you are moving files around but not making sure there isn’t anything in it’s place first. A file move will fail if the destination already exists. The client logs (C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__Global\Logs) are much more helpful with these kinds of operations than the console reporting is.

You should never assume that the path your moving files to is empty (especially in the __Download or client site folders) – you should always run a delete command first. Whenever you call something like:

move "__Download\C162548350E862284139CB81C80913ECF4CEF5AF" "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.lnk" 

You should actually be calling:

delete "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.lnk" 
move "__Download\C162548350E862284139CB81C80913ECF4CEF5AF" "{parameter "SiteDownloadPath"}ACTE 3DSMAX2017.lnk" 

You can get a hint that this is the issue because you are getting different results depending on the number of times you run the fixlet. Sometimes the files aren’t there and it works but sometimes they are there and it fails.

It also looks like there is a lot of superfluous actionscript between parameters, moving things twice, etc.

Test Actionscript

Give this a shot:

begin prefetch block
  add prefetch item name=C162548350E862284139CB81C80913ECF4CEF5AF sha1=c162548350e862284139cb81c80913ecf4cef5af size=951 url=SWDProtocol://127.0.0.1:52311/Uploads/C162548350E862284139CB81C80913ECF4CEF5AF/ACTE%203DSMAX2017.lnk.bfswd sha256=ebf15b747b8453a3a24fa89c0cfcd419e26e1bb9c0cdf8a8df62ac3fc6f489cc
  add prefetch item name=62965ABA5B7A3370619A414F68E8D743FE5B354A sha1=62965aba5b7a3370619a414f68e8d743fe5b354a size=27066 url=SWDProtocol://127.0.0.1:52311/Uploads/62965ABA5B7A3370619A414F68E8D743FE5B354A/ACTE%203DSMAX2017.log.bfswd sha256=b59c6facc6c67457cb6a49450511aba3bd09f8a89015b463ffef32b915f4b71e
  add prefetch item name=93B31CF2A247849A4C195322C4F286447CF0AB99 sha1=93b31cf2a247849a4c195322c4f286447cf0ab99 size=4959243304 url=SWDProtocol://127.0.0.1:52311/Uploads/93B31CF2A247849A4C195322C4F286447CF0AB99/compressedPackageData-201607031556.bftemp.bfswd sha256=864c14e27820dd8605191bbe40f80a90e225bf0491f41a71c484ee38c2707de0
end prefetch block

waithidden cmd.exe /c "rmdir /s /q {name of drive of system folder}\3DSMAX"
folder create "C:\3DSMAX\3DSMAX2017"

extract "93B31CF2A247849A4C195322C4F286447CF0AB99"

move "__Download\C162548350E862284139CB81C80913ECF4CEF5AF" "{name of drive of system folder}\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.lnk"
move "__Download\62965ABA5B7A3370619A414F68E8D743FE5B354A" "{name of drive of system folder}\3DSMAX\3DSMAX2017\ACTE 3DSMAX2017.log"
move "__Download\Img" "{name of drive of system folder}\3DSMAX\3DSMAX2017\Img"
move "__Download\SMS_SCCM scripts" "{name of drive of system folder}\3DSMAX\3DSMAX2017\SMS_SCCM scripts"
move "__Download\Tools" "{name of drive of system folder}\3DSMAX\3DSMAX2017\Tools"

waithidden "{name of drive of system folder}\3DSMAX\3DSMAX2017\Img\setup.exe" /qb /I "{name of drive of system folder}\3DSMAX\3DSMAX2017\Img\ACTE"

Notes:

  1. I’ve removed the basefolder parameter because we are doing some pretty basic stuff here and calling “__Download\File” will simplify our actionscript
  2. folder create does not fail if the folder already exists so we do not need to check first.
  3. An appendfile with only one line should almost always be a waithidden instead of an appendfile
  4. Unless we need absolute paths it’s always easier to just use “__Download\MyFile” than it is to use a parameter to get us to the download folder.
  5. We should avoid renaming files in __Download\ unless we have to. If we can leave them as their original names then we don’t have to do any cleanup nor do we have to rename them.
  6. We should try to use waithidden instead of dos
  7. We should avoid hard coding C:\ and instead use relevance that brings us to the location we want (in this case name of drive of system folder)

Thanks so much for all of your help! I understand how the “__Download” folders work a lot better now.
3DS Max is now working perfectly as well as the other Autodesk applications that I’ve set up similarly. You guys are lifesavers :slight_smile:

1 Like

I just came across this thread and I am hoping that someone may guide me in the right direction. I am attempting to use the WSD to create a compressed folder that will be extracted on the local machine. I then need to move the extracted files /subfolder into a directory within the end user machine. I was able to successfully upload the folder, got my sha etc details, I can see the file in the _download folder of the client machine. When I attempt to use the extra and move /copy functions I never get anything to work.

I am not sure where the extracted files are temporarily placed or if perhaps I didn’t upload them properly.

I used the wizard and then used the folder and checked the subfolder option to create a compressed file. I copied the example above and fail at the end when it is time to move the files into the specific folder.

i generalized the url and the “foldername”

Completed begin prefetch block
Completed add prefetch item name=07b8c58f4407f0ed1af1de66b9664592d8953fcc sha1=07b8c58f4407f0ed1af1de66b9664592d8953fcc size=1026212 url=http://myserverurladdress/Test.tmp sha256=42b3f39c1fe09d80aa991ce084b48dd65ee4776ec7e38619cb3050e258fa30c6
Completed end prefetch block
Completed waithidden cmd.exe /c "rmdir /s /q {name of drive of system folder}\Test"
Completed folder create "C:\Test"
Completed extract "07b8c58f4407f0ed1af1de66b9664592d8953fcc"
Failed move “__Download\07b8c58f4407f0ed1af1de66b9664592d8953fcc” "{name of drive of system folder}\Test"
move “__Download\Test” “{name of drive of system folder}\ProgramData\Foldername”

When you use extract like this the extract is done inside the __Download folder

Not sure why you are trying to move the archive that you just extracted as the extract command deleted it when it extracted.

See https://developer.bigfix.com/action-script/reference/file/extract.html

AlanM- Thanks for the feedback, i will look into the link you provided. Since I am very new to BigFix and the tools, i have limited knowledge of the tasks and their commands. I was under the impression that the folder that i compressed would need to be extracted so we had the original folder and subfolder and then move them to where i need them.

My overall goal was to copy a folder that contains a subfolder and files over to the BES server using the windows software distribution wizard and then create a task that would download it to the client computers and move it to a specific folder on the system drive regardless if the folder exited or not.

If you look at the link provided, there is a later variant of the command that lets you extract into a specific directory so you don’t need to move things as well.