I'm working on making some scripts more elegant by implementing them in a real x application etc...
At some point in the scripts we basically want to take everything from a mounted removable storage device, and copy into specified folder in a tmp work folder. When executing in the shell it works without a hitch. When executed from the code, it fails.
cp -avfr /tmp/mnt221234jk/* /tmp/mnt23255/disk1/
and the error I get from native app is:
cp: cannot stat: '/tmp/mnt221234jk/*' file not found.
The strange part is that it is absolutely there, has appropriate permissions for the user running the app etc. I can both
stat /tmp/mnt221234jk/* and run the cp command from the shell and both work just fine.
In addition to this, if I omit the
/* from the file copy origin, it works, but creates a new folder in the destination with name
mnt221234jk which is not what I am looking for.
A couple of side notes: my code to execute shell commands absolutely works, and works well. But there very well may be something funky about needing work paths or something like that.
Does failing to stat based on file not existing error ring any bells with anyone?
I'd be willing to attempt to achieve this differently if there are alternative shell commands to effectively copy a file structure recursively with permissions etc.