Skip to content

detect filetype (as in unix 'file')

3 messages · Jeroen Ooms, Brian Ripley

#
Is there a way in R (in Linux) to detect the type of a file without invoking
a shell? E.g to do this:
density.plot: PDF document, version 1.4

but without using system()? I tried file() and file.info(), but both do
display the information I am looking for.



--
View this message in context: http://r.789695.n4.nabble.com/detect-filetype-as-in-unix-file-tp3424562p3424562.html
Sent from the R help mailing list archive at Nabble.com.
#
On Sun, 3 Apr 2011, Jeroen Ooms wrote:

            
No, but what is wrong with using system()?

'file' is large and complex because it tries to be comprehensive (but 
it still does not know about some common systems, e.g. 64-bit Windows 
binaries).  There simply is no point in replicating that in R: which 
is why we chose rather to port 'file' to Windows and provide in in 
Rools.
1 day later
#
The application is running in a very sandboxed environment and might
not have permission to execute 'file'.
Alright that makes sense, thanks.