Seeking help with script - copy file to Android device
Posted: 22 Jan 2024 18:57
Trying to write a script to automate file management on an Android device. I can browse to the folder and manually copy/paste/delete/rename files. Running into problems with the script itself when I try to use variables instead of hard-coded values:
I also tried renaming the $file variable to something else in case it was a reserved word; same errors.
How do I create the $fullpath variable by concatenating its component parts? Any help appreciated.
Code: Select all
$sourcefile = "E:\DroneRawFiles\output.kmz"
$file = "40C7BC61-616C-4B5E-9840-0DD500E20E40";
$folder = "DJI RC 2\Internal shared storage\Android\data\dji.go.v5\files\waypoint\" ;
// this works
$fullpath = $folder . "40C7BC61-616C-4B5E-9840-0DD500E20E40" . "\";
goto $fullpath;
// this fails
// $fullpath = $folder . "\" . $file . "\";
// goto $fullpath; // error: path not found
// echo $fullpath; // the output includes the literal "$file" instead of the current value
// this fails
delete $fullpath . "40C7BC61-616C-4B5E-9840-0DD500E20E40.kmz"; // error: Nothing to delete
echo $fullpath . "40C7BC61-616C-4B5E-9840-0DD500E20E40.kmz"; // it looks correct in the message
How do I create the $fullpath variable by concatenating its component parts? Any help appreciated.