Getting file types in directory structure.
I have a directory with 5000 files in it in 1000 folders. I
need to parse through all these files and construct a list of file
types (.jpg, .doc, .pdf etc) These types will be entered into a
database table so we have a distinct list of file types that we
have. I'm just wondering what everyone's opinion on the easiest way
to accomplish this is. Obviously CFDIRECTORY comes to mind doing
some crazy loops, but I started and was just thinking there might
be a better/easier way to do this.
Any suggestions?
THANKS
Yeah I got that part as far as parsing out the file type from
the name that cfdirectory spits out. It's the recursion of the
dierctories that I'm having problems with. If it was just one
directory full of files this would be a snap but there are
directories 3-4 levels deep. Just trying to figure out the best way
to loop through the files in a directory but also loop through
files in sub directories.
Similar Messages
-
Why is Get File Type.vi password protected
Hi... We have a code that was developed in LabVIEW 8.6... We have a need to attempt to save this code all the way back to version 7.1... I saved it back from 8.6 --> 8.5 --> 8.2.1 --> 8.0 with no issues... But when I then try to save it back from 8.0 to 7.1 I encounter one LabVIEW 8 vi that has no equivalent functionality in 7.1... And that one vi is
C:\Program Files\National Instruments\LabVIEW 8.x\vi.lib\Utility\lvfile.llb\Get File Type.vi
When I look at that vi in 8.x, to endeavor to see if I can replace its functionality by writing some code in 7.1, I find that the Get File Type.vi is password protected... More out of curiousity than anything, why is that code password protected??? I wasn't aware that any of the standard purchased LabVIEW code came password protected... Can anyone tell me why that is??? thanks... bob..
Solved!
Go to Solution.That VI is using an internal callback into LabVIEW (i.e. non G-based code) to determine the type of the file. I'm guessing the callback doesn't exist in 7.1, so you would need to write your own G-based implementation for getting the type of a file in the 7.1 case. The simplest solution would be to work with the extensions of the files...not perfect, but probably close enough assuming your files are well-named. Also, the following VI can give you a bit more information about LabVIEW-specific files (independent of extension):
LabVIEW 7.1\vi.lib\Utility\libraryn.llb\Librarian Get Info.vi
Darren Nattinger, CLA
LabVIEW Artisan and Nugget Penman -
how get File Type Icon Image (Windows )
FileSystemView.getSystemIcon( File );works in swing application, can not be used for javafx.scene.image.ImageView;Hmm, good question.
Looking at the FileChooser, it looks like the native chooser is used so possibly the JFX guys didn't have to expose access to the icons to make it work. You might want someone to confirm, but my guess is there is no equivalent yet in JFX.
Assuming there's nothing, you could try the hacks in here to convert the image: Image conversion between AWT and FX
Failing that you're probably looking at raising a JIRA feature request to get it in a future release.
Cheers,
zonski
Did you find this answer useful? If so, please mark as 'Correct' or 'Helpful'. -
How to get File type icon for files store on Amazons3
Hi,
i want to know about how to get file type icons for files that we store on Amazons3.i am a devloper ,i want to make gui for accessing amazons3.
so ,i want to know about how to get file type icons for files that we store on Amazons3.
thanx in advance.hi,
have u heard amazon simple storage service,that provides storage space for
storing files, i am a devloper,i want to know the files that we store on amazon,how we can get file type icon for that files.
i want to sample code in java for this.
thanx in advance. -
Getting files of a directory in app server
Hi,
Is there any FM or method to get all the files of a directory ( in the application server )if its path is given as input.
It should list the file name, creation date and also size.
Thanks,
Nawaz.Hi,
you can use the follow code:
REPORT zdirtest.
DATA lv_dir TYPE rsmrgstr-path VALUE '/usr/sap/trans/data'.
DATA: wa_files TYPE rsfillst,
it_files LIKE TABLE OF wa_files.
START-OF-SELECTION.
CALL FUNCTION 'SUBST_GET_FILE_LIST'
EXPORTING
dirname = lv_dir
filenm = '*'
TABLES
file_list = it_files
EXCEPTIONS
access_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE /1 'Error! :-('.
ELSE.
LOOP AT it_files INTO wa_files.
WRITE: /1 wa_files-name,
wa_files-len.
ENDLOOP.
ENDIF.
However the field <b>MTIME</b> from the structure <b>RSFIILST</b> is not filled correctly with the number of seconds since 1970 because the field is defined to small.
So you can't list the correct modification date and time.
If you really need this, you should take a look in the Report <b>RSWATCH0</b> in the form <b>fill_file_list</b>.
This form fills an internal table with the correctly modification date and time.
Regards,
Stefan -
Get file list from directory(t.code: AL11).
Hi Frnds,
i need to get the list of file for particular directory from t.code AL11,
is there any Function Module to display the list of File from the directory in executable program,
i have directory like '/home/im3/hrintf/processed/..... ' and now i need to get the list of file from that directory,
the list is available in t.code AL11( standard program :RSWATCH0 ).
pls suggest me with relevant FM or relevant logic.
Thank you.
Regards
Ramesh MHi
use this code i have checked its working fine
Data:
w_itab type table of EPSFILI,
w_dirnam type EPSF-EPSDIRNAM.
w_dirnam = 'C:\usr\sap\E6S\DVEBMGS00\work'.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = w_dirnam
* FILE_MASK = ' '
* IMPORTING
* DIR_NAME =
* FILE_COUNTER =
* ERROR_COUNTER =
tables
dir_list = w_itab
* EXCEPTIONS
* INVALID_EPS_SUBDIR = 1
* SAPGPARAM_FAILED = 2
* BUILD_DIRECTORY_FAILED = 3
* NO_AUTHORIZATION = 4
* READ_DIRECTORY_FAILED = 5
* TOO_MANY_READ_ERRORS = 6
* EMPTY_DIRECTORY_LIST = 7
* OTHERS = 8
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write: 'test'.
Thanks
Viquar Iqbal -
Changing file name and directory structure for use outside of iPhoto
Hi,
I was wondering if its possible to get iPhoto to name the files from my library to reflect the names that I've given the files in iPhoto. I'm thinking along the lines of iTunes, where its possible to chose in the preferences how the files are named, and there is some logical directory structure, such as "Artist/Album/01 - Track 1.mp3". These file names are updated to reflect any changes made in iTunes.
I've heard the argument that I shouldn't ever want to do anything with the files themselves because iPhoto can do everything I would ever want to do, but I want to organize the files so that not all of my organizational work is lost if I decide to stop using iPhoto and transition to a different system. Any suggestions would be appreciated.
Thanks,
AdrianAdrian
No it's not possible.
You can rename the files before bringing them into iPhoto, you can rename them with the titles on Export (Use the File -> Export command, it gives you the option to use the title and filename) but when it's inside iPhoto you cannot rename the files.
However, all is not entirely lost. Using Film Rolls (View -> Film Rolls) you can move pics between rolls, name rolls, create rolls and so on, as long as you do this in the iPhoto Window, and these changes will be reflected in the iPhoto Library Folder.
If at some point you decide to chuck iPhoto then (if the new app won't read iPhoto database files) you can simply export each album you've created to a Folder (using the File -> Export command as I suggest above), this, along with exporting slideshows will preserve your organisational efforts.
The iTunes database has a rather simple job to do: track a file and it's assorted metadata. iPhoto, on the other hand, tracks a file and it's assorted metadata, plus a Modified version, plus a thumbnail. If you consider what happens when you edit a pic, for instance - Copy Original, perform edit, save modified version, remove Original Thumbnail and then create new one - you can see it's a rather more complex job.
Finally, the standard warning: It is strongly advised that you do not move, change or in anyway alter things in the iPhoto Library Folder as this can cause the application to fail and even lead to data loss. Any changes you make must be made in the iPhoto Window.
Need more info? by all means post again.
Regards
TD -
Compiling files with nested directory structure
I'm getting "resolve symbol" errors when I try to compile source files which
are in the child directory whose dependent on files from it's parent
directory. Here's my current directory structure:
src
-->a
---->b
------>util
What I'm trying to do is compile files which are in the 'util' directory.
Some of these files use some of the classes in the 'b' directory. My
compile statement is the following:
java -d class -classpath src src\a\b\util\aFile.java
Files in the 'util' directory has a import a.b.* statement on top, but I
don't think that's the problem, let alone necessary.
Any assistance would be appreciated.Files in the 'util' directory has a import a.b.*
statement on top, but I
don't think that's the problem, let alone necessary.You must import classes that you use if the classes are not in the same package. The classes in src\a\b should have a package statement as the first line of source code and I am guessing it should be "package a.b;" Likewise, the classes in src\a\b\util should have a "package a.b.util" line. It's hard to guess what you have in mind. If you have the package statements, then the classes in a.b.util can import a.b.whatever. This will work. -
Where to put simple html-file in WebLogic directory structure?
After installing JDeveloper 11g and WebLogic 10.3 which came in the same exe-file (jdevstudio11110install.exe), I want to try WebLogic as a ordinary web server for a simple html-file. Where should the file be placed in WebLogics directory structure, and are there any settings that need to be done to get this to work?
Thank you, Maxence -
I made it work this way:
- Entered the following in weblogic.xml for a simple dummy-servlet...
(WebLogicServletTest-ProjectWebLogicServletTest-context-root)
... deployed to the WebLogic server:
<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app>
<virtual-directory-mapping>
<local-path>C:\WorkScratch\</local-path>
<url-pattern>*.html</url-pattern>
</virtual-directory-mapping>
</weblogic-web-app>
WebLogic served up the hoppla.html-file in the C:\WorkScratch directory with the following browser URL:
http://192.168.15.108:8900/WebLogicServletTest-ProjectWebLogicServletTest-context-root/hoppla.html -
I am using cfdirectory to read a directory but I need to get
the extension of the files in the directory. I cant seem to find
anything about it. I can get whether its a file or directory with
cfdir... but not the extension such as if the file is jpg, png,
html, or swf etc.. I have searched high and low with no luck. Is
there a way to do that?
thanx
davequote:
Originally posted by:
SpiderFromMars
This is the best example to use! Very tight!!!
I would, however, put the CFOBJECT tag outside of the loop
and desolve it at the end.
<cfset scan_dir
="C:\path_to_whatever_you_want_to_query">
<cfdirectory directory="#scan_dir#" action="list"
name="qryDir">
<CFOBJECT TYPE="COM" CLASS="Scripting.FileSystemObject"
NAME="FSO" ACTION="CREATE">
<cfloop query="qryDir">
<cfif Type is "File">
<CFSET path = "#qrydir.name#">
<cfscript>
theFile = FSO.GetExtensionName(path);
</cfscript>
<cfoutput>
The file Ext is: #theFile#<br>
</cfoutput>
</cfif>
</cfloop>
<cfset FSO = ''>
Yeah that would probably keep some of the overhead down
setting the COM object outside the loop. -
Organize iTunes file list by Directory Structure instead of artist/album?
Hello, I have searched for different audio players for os x which might have this feature but so far have had no luck. What I'm looking for is a feature similar to that of foobar2000 for win32 where I can organize my music by directory structure without the iTunes automatic organization by artist/album. Is there a way I can accomplish this in iTunes with some sort of xml config or hidden options? Thanks.
You don't have to have iTunes move music around on your hard drive (Preferences>Advanced>General, uncheck Keep iTunes Music folder organized and Copy files to iTunes Music folder when adding to library) but I suspect that's not what you're asking. You can't automatically view music from within iTunes by directory structure. iTunes organizes by ID3 tags ("mp3 tags"). You could, I suppose, spend a lot of time replicating your directory structure by using folders and playlists within iTunes but you'd probably have to do it all by hand.
You could check out Doug's Scripts to see if there are some scripts that might help.
http://dougscripts.com/itunes/index.php -
How to Get File type in webdynpro abap
Hi,
I am using File Upload UI element of webdynpro ABAP to upload data into SAP table. I want that the file type should only be tab delimited. How to get the file type to validate the same.
Regards,
Dhiraj Mehtahi,
just follow the link :
http://help.sap.com/saphelp_40b/helpdata/en/2a/fa02b7493111d182b70000e829fbfe/content.htm
Hope this will help u!!!
thanks & regards,
punit raval. -
Exception handling in File adapter when directory structure is incorrect
hi,
How can exception handling part be done in File adapter in cases where directory structure is incorrect, or directory
we are referring to is not present.
thanks
YatanIf you are polling then there will be error message in log files.But i dont think we can do exception handling in such cases.
Cheers -
How to get file type within SPFile
Hi,
I have a document library and I would like to get the type of document so it can be displayed for the user
Currently I have this code
foreach (SPListItemVersion version in item.Versions)
if (version.Level == SPFileLevel.Published)
string fileicon = version.ListItem.File.IconUrl;
string filetype = version.ListItem.File.Item.ContentType.Name;
string filesize = (version.ListItem.File.Length / 1024).ToString();
string filetitle = version.ListItem.File.Item.Title;
string filepath = version.ListItem.File.ServerRelativeUrl;
Within the code I get the "ListItem.File.Item.ContentType.Name" and this always returns "Document" even if its a Word Document, Spreadsheet, jpg or PDF.
I really want to display, Document, spreadsheet, pdf, etc etc
How do I get this property??
Thanks
MarcYou can use the ListItem.File.Name property to get the full file name including the extension, you could then parse this to get just the extension and determine the file type based on that.
Note that when parsing the file name, if you try to do it by splitting the filename using the period symbol "." as the seperator you will need to allow for file names which contain multiple period symbols. You may be able to use the System.IO.FileInfo class to help, it has an instance property 'Extension' which should take care of that for you, though getting an SPFile into a FileInfo object may be more hassle than just writing your own quick parser, I haven't tried it. -
Hi,
Can anyone help me on how to find the input file type i.e. pdf or txt or word.
Is there any function similar to what we have to get the filename in OSB.
In fact I have a requirement where I have to send a mail with the attached incoming file and the incoming file can be of any type.
Please help me as I need this urgently.
Thanks in advance...
Regards,Hi,
You can use xquery function tokenize($input,$pattern) to separate file name extension alone from complete file name.
And for sending email with attachments follow this tutorial. http://blogs.oracle.com/christomkins/2009/04/sending_an_email_with_an_attac.html.
Thanks,
Maybe you are looking for
-
I want to install Windows 7 on my 2010 MacBook Air running Lion - Bootcamp Assistand 4.0.1 from a USB drive. I've done this in the past when I was running Snow Leopard and the process was rather easy but now Lion updated the Bootcamp Assistant so i'm
-
Hello - I have a scenario like this, appreciate if any BW gurus help me. Existing Cube : A. Cubes : X(daily snapshot data) and Y(monthly snapshot data). MultiProvider : Z Load Latest 3 months (92 requests) data on daily wise into the X cube from alre
-
View videos in list, not thumbnail view.
I just bought the new iPad and so far it is great. I have loaded a bunch of TV shows and movies onto it. The problem is that I can only see the files in thumbnail view which is awkward to say the least. How can I view it in list format or anything ot
-
Hi, Is there a solution for making automatic activation for Microsoft products (Windows and Office, maybe more)? We currently have VAMT server and one user does the activation for all sites. As we are growing, we need MS products to be activated once
-
HT201364 what is the best way to open up disk space on my macbook pro
WHAT IS THE BEST WAY TO FREE DISK SPACE ON MY MACBOOK PRO, I NEED SPACE TO DOWNLOAD YOSEMITE