Moving a folder from _Download to a different directory

Hello team,

I am trying to create a fixlet through SWD Wizard wherein I need to transfer the entire folder to a different directory. Since there are no available action script for moving directories, I am planning to use OS commands executed through actionscript.

Not completely sure how the construction of the action script. I saw this one command for executing .bat file:

wait “{pathname of system folder & “\cmd.exe”}” /C “{(pathname of client folder of current site) & “__Download{(pathname of client folder of current site)}__Download\RunCleanWipe.bat”}”

Which makes me think that the format would be something like:

wait “{pathname of system folder & “\cmd.exe”}” /C

Can you give me ideas of how can I get the action script I need or atleast verify if the format is correct?

Thank you.

Hello,

All you should need to run a batch file that you are downloading (not using appendfile or createfile) is this:

waithidden "__Download\run.bat"

Bill

Hello,

Thank you very much for the response Bill. I agree that the bat file can be simply ran that way but my main concern is moving the folder to another directory. The action script above is just a sample of using the OS OS commands executed through actionscript.

I tried the following action script below but the folder was not moved and resulted to an exit code=1:

wait “{pathname of system folder & “\cmd.exe”}” /C move C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData\actionsite__Download\shutting C:\

If you have a set of batch commands you know works you can use bigfix to write out a batch file and then run it.

delete __createfile
delete run.bat

createfile until _end_

Your Commands Here

_end_

move __createfile run.bat

waithidden run.bat

So if you had something in the downloads folder you wanted to move – and the command you’re using is Move then it would be:

delete __createfile
delete run.bat

createfile until _end_

move __Download\Shutting C:\

_end_

move __createfile run.bat

waithidden run.bat

So everything between createfile until _end_ and _end_ will get written to a batch file and then waithidden run.bat will run the file.

Hello Bill,

Okay I think this alternative is what I can try out for the moving of folders. Just to confirm, the second set of command above would need to be on a bat file too which needs to go along with the folder I am moving and I need to execute this so that I can move the folder? Or these commands can already be added on the fixlet action script?

Sorry still new to scripting :slight_smile:

Hang on

The command I tried earlier using the OS command worked:

wait “{pathname of system folder & “\cmd.exe”}” /C move C:\Program Files (x86)\BigFix Enterprise\BES Client_BESData\actionsite_Download\shutting C:\

The previous action I deployed, the C:\Program Files (x86)\BigFix Enterprise\BES Client_BESData\actionsite_Download\shutting does not have quotations and the quotations are needed because there is a space between BES and Client. Once I changed the command to the one below, it was able to transfer it:

wait “{pathname of system folder & “\cmd.exe”}” /C move “C:\Program Files (x86)\BigFix Enterprise\BES Client_BESData\actionsite_Download\shutting” C:\

Thank you.

For your reference later – this is all you would put in the actionscript like this:

Whatever you put between createfile until _end_ and _end_ will become a batch script that waithidden run.bat will run

1 Like

Hello Bill,

I will try this scripts too. Thank you very much for the additional info regarding the action scripts :smiley:

You can use the 'move' actionscript command to move folders

So in your case it would be:

move __Download\Shutting C:\Shutting 

The format of the move actionscript command is a bit different but this would work as well.

2 Likes

Hello Alan,

I did try the copy before and the folders seem to be not copied but I haven’t tried the move command. Maybe there is something wrong with my format for the copy. I will try this too for both move and copy command. Thank you.

Be aware of the differences in syntax between the DOS/cmd format of the OS “move” command and the actionscript “move” command

When you use either createfile or appendfile, the resulting file is stored in the client folder for that site - one level above the __Download folder. You can take advantage of that with relative pathing, instead of entering the entire “C:\Program Files (x86)…” path (and especially not assuming the “actionsite” site name. You also have the full system path in effect, so you don’t necessarily need the full path to cmd.exe (but you should disable 32-bit redirection). BUT there are known problems with “wait” or “waithidden” not doing a good job handling more than one quoted value on the command line, so you may be better off putting the command into a batch file.
A couple of options below…

action uses wow64 redirection false
delete __createfile
createfile until EOF_EOF_EOF
move __Download\Shutting C:\Shutting
EOF_EOF_EOF
delete mymove.cmd
move __createfile mymove.cmd
waithidden cmd /c mymove.cmd

option 2 - just to show some of the folder name evaluations you can use

action uses wow64 redirection false
delete __createfile
createfile until EOF_EOF_EOF
move "{pathname of folder "shutting" of download folder}" "C:\shutting"
EOF_EOF_EOF
delete mymove.cmd
move __createfile mymove.cmd
wait cmd /c mymove.cmd
1 Like