random file from directory

random files from directory

Get Random Files From Directory Using Shell Script

Random files from directory is most sought after operation specially when working with files. You may be creating video from image, analyzing sample data and more.

Shell scripting has a lot to offer, not only random files from directory. The cool thing about shell script is, it is more native and fast.

I am working on generating videos from selected images and I needed to have ability to select random files from the given folder.
Continue reading random files from directory

lmagick works from command line but not from php script, sh: convert: command not found

Working with something that needs a shell access, like working with awesome imagick function and stuck with sh: convert: command not found

The thing is it works when the same command that run from php script is run on the command line.
It is a path issue.

exec("convert soruce.ext converted.ext", $report);

Here the report would tell how it goes and it will get back with the news

sh: convert: command not found

Now do

which convert

To get the full path of the command and use it

exec("full-path-to-convert source.ext converted.ext", report);

The above would work for any command that creates related problems.