How to move descendants of folder to new folder using action script

In RHEL 7 & 8, we need to move an application to it’s own filesystem off rootvg and wanted to automate the process but moving the files from the old directory to the new directory on a dedicated mount point is giving me problems. (I thought this would be the easy part!)

If the folder is on “/” fs, move to backup location:

if { ((exists folder "/opt/application") AND (volume of it of filesystem "/opt/application" = "/")) }
	move "/opt/application" "/opt/application_nofs"
endif

Filesystem creation happens here no problem, then moving the files from the “_nofs” backup directory to the new directory fails and I’m not seeing the issue. (It’s late on Friday though…)

I’ve tried

if { (exists folder "/opt/application_nofs") }
	move  "/opt/application_nofs/*/*" "/opt/application/"
endif

and

if { (exists folder "/opt/application_nofs") }
	move  "/opt/application_nofs/*" "/opt/application/"
endif

The errors are typical as shown:

At 18:57:11 -0400 - actionsite (http://bigfixuat:52311/cgi-bin/bfgather.exe/actionsite)
   Command failed (Move of '/opt/application_nofs/*/*' to '/opt/application_tmp' failed (0 - File error "17FileNotFoundError" on "/opt/application_nofs/*/*")) move  "/opt/application_nofs/*/*" "/opt/application_tmp/" (action:4970)

At 18:54:02 -0400 - actionsite (http://bigfixuat:52311/cgi-bin/bfgather.exe/actionsite)
   Command failed (Move of '/opt/application_nofs/*' to '/opt/application_tmp' failed (0 - File error "17FileNotFoundError" on "/opt/application_nofs/*")) move  "/opt/application_nofs/*" "/opt/application_tmp/" (action:4969)

I can use Linux command line to do this but I wanted to see if I am missing something obvious here before I resorted to that. Is this not easily accomplished using action script?

I believe the ActionScript “move” command is intended for single files, not directories. I’d probably try using the OS move command instead, i.e.

wait mv /path/to/source /path/to/dest

Thanks Jason. I used the OS as suggested but had myself convinced I’d done that in the past.

Looking back at old content I see the action script ‘move’ used on directories with no issues but it’s always been single/specific directories - no wildcards.

1 Like