|
Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own. |
|
Thread Tools | Display Modes |
|
|||
any unix utility that determines the right extension of a file ?
Hi everyone !
Suppose you've got a 'extension-less' file and you'd want to a handy tool to determine the right extension of that file .. Does such a tool exist in Unix Land ? Regards. Last edited by daemonfowl; 21st March 2013 at 12:57 AM. |
|
|||
Hi teacher jggimi and thanks for your reply !
Yes, in Unix everything is a file .. and yet I need to be able to decide about such files .. before sending them to a target OS : windoze. |
|
|||
Quote:
% file testfile or % file *
__________________
May the source be with you! |
|
|||
Code:
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Thank you so much. That's just what I needed !
|
|
|||
You would almost certainly need to customize the output to your needs, but there seems to be a CPAN module that can map file mimeinfo to typical (windows?) file extensions: http://search.cpan.org/~pardus/File-...le/MimeInfo.pm
Quote:
|
|
|||
Thanks thirdm !
Code:
Running Build install Building File-MimeInfo Installing /usr/local/man/man1/mimeopen.1 Installing /usr/local/man/man1/mimetype.1 Installing /usr/local/libdata/perl5/site_perl/File/MimeInfo.pm Installing /usr/local/libdata/perl5/site_perl/File/MimeInfo/Rox.pm Installing /usr/local/libdata/perl5/site_perl/File/MimeInfo/Applications.pm Installing /usr/local/libdata/perl5/site_perl/File/MimeInfo/Magic.pm Installing /usr/local/libdata/perl5/site_perl/File/MimeInfo/Cookbook.pod Installing /usr/local/man/man3p/File::MimeInfo.3p Installing /usr/local/man/man3p/File::MimeInfo::Cookbook.3p Installing /usr/local/man/man3p/File::MimeInfo::Rox.3p Installing /usr/local/man/man3p/File::MimeInfo::Magic.3p Installing /usr/local/man/man3p/File::MimeInfo::Applications.3p Installing /usr/local/bin/mimeopen Installing /usr/local/bin/mimetype PARDUS/File-MimeInfo/File-MimeInfo-0.16.tar.gz ./Build install -- OK .iso mimetype seems different though : When I mv x.iso to x , its size gets smaller and mimetype fails to determine its id -so to speak- it says : text/plain instead of x-cd-image. The file command however seems smarter , same output for ipxe which is actually ipxe.iso : Code:
file ipxe ipx: ISO 9660 CD-ROM filesystem data 'CDROM ' (bootable) |
|
|||
Code:
for f in $(find . type f ); do (mimetype "$f" | tee -a /tmp/files.mimetype); done
__________________
FreeBSD 13-STABLE |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unable to install php5-gd extension | schh | OpenBSD General | 6 | 16th June 2011 06:57 PM |
.wav file playing very fast on unix, fine on win | gosha | General software and network | 16 | 2nd June 2009 02:37 PM |
USB extension cable: bad? | IdOp | General Hardware | 3 | 24th January 2009 08:41 PM |
Remote backup utility | stukov | General software and network | 18 | 13th June 2008 08:42 PM |
php cli and imagick extension | mtx | FreeBSD General | 5 | 22nd May 2008 08:51 PM |