Query on files
Hi,
Introduction:
I have created a directory namely 'Java', which contains many directories and files.
Problem:
I need to get a list of files(not directories) within the above mentioned directory. This list should be sorted on 'last-modified' file attribute.
Query:
I'am aware of 'lastmodified' method of 'File' class. I'am also aware of 'listFiles' and 'isFile' method of File class. I do understand that Comparator can be used and the list of files can be sorted according to last-modified property. But, I want to know is there a better way or a Java API to do the needful.
Thanks in advance.
Best Regards,
Jay
Nope, you've pretty much nailed it down. Recursively fetch the file list, filter out anything that's a directory, and then sort using a custom comparator. Good job breaking it down into those steps. :)
Similar Messages
-
How to query XML file RDL SSRS Report to find column titles?
I have list of SSRS reports theirRDL file. How can we query the file to find like text book name as below( <Textbox Name="bippie_passed_qa_photostamps_orders_amount">). Catlog t able in report server does not provide column title
but i am trying to find column title through RDL file. How can we query in SQL server 2012 version too? I am new in XML please help is appreciated.
</Textbox>
</CellContents>
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="bippie_passed_qa_photostamps_orders_amount">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!bippie_passed_qa_photostamps_orders_amount.Value</Value>
<Style>
<FontSize>8pt</FontSize>
<Format>'$'#,0.00;('$'#,0.00);''</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>You will first need to get your report XML from the dbo.Catalog table but something like this should work:
-- !!TODO get your report XML from the dbo.Catalog table
DECLARE @ssrsXML TABLE ( yourXML XML )
INSERT INTO @ssrsXML
SELECT '<TablixCell>
<CellContents>
<Textbox Name="bippie_passed_qa_photostamps_orders_amount">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!bippie_passed_qa_photostamps_orders_amount.Value</Value>
<Style>
<FontSize>8pt</FontSize>
<Format>''$''#,0.00;(''$''#,0.00);''''</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
</Textbox>
</CellContents>
</TablixCell>'
SELECT t.*, c.c.value('@Name', 'VARCHAR(100)' ) nameProperty
FROM @ssrsXML t
CROSS APPLY yourXML.nodes('//TablixCell/CellContents/Textbox' ) c(c) -
In dreamweaver site-wide query option file grayed out
in dreamweaver site-wide query option file grayed out
Why won't this button option work, I cannot get the site-wide query to highlight, please help anyone, thanks.You need to have a defined site in order for DW to correctly work with your files...
http://tv.adobe.com/watch/learn-dreamweaver-cs5/gs01-defining-a-new-site/
Once defined, you will always work from the Dreamweaver Files panel to ensure the program can manage your files correctly. -
Location of query log files in OBIEE 11g (version 11.1.1.5)
Hi,
I wish to know the Location of query log files in OBIEE 11g (version 11.1.1.5)??Hi,
Log Files in OBIEE 11g
Login to the URL http://server.domain:7001/em and navigate to:
Farm_bifoundation_domain-> Business Intelligence-> coreapplications-> Dagnostics-> Log Messages
You will find the available files:
Presentation Services Log
Server Log
Scheduler Log
JavaHost Log
Cluster Controller Log
Action Services Log
Security Services Log
Administrator Services Log
However, you can also review them directly on the hard disk.
The log files for OBIEE components are under <OBIEE_HOME>/instances/instance1/diagnostics/logs.
Specific log files and their location is defined in the following table:
Log Location
Installation log <OBIEE_HOME>/logs
nqquery log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1
nqserver log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1
servername_NQSAdminTool log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1
servername_NQSUDMLExec log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1
servername_obieerpdmigrateutil log (Migration log) <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1
sawlog0 log (presentation) <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIPresentationServicesComponent/coreapplication_obips1
jh log (Java Host) <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIJavaHostComponent\coreapplication_obijh
webcatupgrade log (Web Catalog Upgrade) <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIPresentationServicesComponent/coreapplication_obips1
nqscheduler log (Agents) <OBIEE_HOME>/instances/instance1/diagnostics/logsOracleBISchedulerComponent/coreapplication_obisch1
nqcluster log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIClusterControllerComponent\coreapplication_obiccs1
ODBC log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OracleBIODBCComponent/coreapplication_obips1
opmn log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OPMN/opmn
debug log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OPMN/opmn
logquery log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OPMN/opmn
service log <OBIEE_HOME>/instances/instance1/diagnostics/logs/OPMN/opmn
opmn out <OBIEE_HOME>/instances/instance1/diagnostics/logs/OPMN/opmn
Upgrade Assistant log <OBIEE_HOME>Oracle_BI1/upgrade/logs
Regards
MuRam -
Best way to spool DYNAMIC SQL query to file from PL/SQL
Best way to spool DYNAMIC SQL query to file from PL/SQL [Package], not SqlPlus
I'm looking for suggestions on how to create an output file (fixed width and comma delimited) from a SELECT that is dynamically built. Basically, I've got some tables that are used to define the SELECT and to describe the output format. For instance, one table has the SELECT while another is used to defined the column "formats" (e.g., Column Order, Justification, FormatMask, Default value, min length, ...). The user has an app that they can use to customize the output...which leaving the gathering of the data untouched. I'm trying to keep this formatting and/or default logic out of the actual query. This lead me into a problem.
Example query :
SELECT CONTRACT_ID,PV_ID,START_DATE
FROM CONTRACT
WHERE CONTRACT_ID = <<value>>Customization Table:
CONTRACT_ID : 2,Numeric,Right
PV_ID : 1,Numeric,Mask(0000)
START_DATE : 3,Date,Mask(mm/dd/yyyy)The first value is the kicker (ColumnOrder) as well as the fact that the number of columns is dynamic. Technically, if I could use SqlPlus...then I could just use SPOOL. However, I'm not.
So basically, I'm trying to build a generic routine that can take a SQL string execute the SELECT and map the output using data from another table to a file.
Any suggestions?
Thanks,
JasonYou could build the select statement within PL/SQL and open it using a cursor variable. You could write it to a file using the package 'UTL_FILE'. If you want to display the output using SQL*Plus, you could have an out parameter as a ref cursor.
-
Webanalysis : Query Log File
Hi,
Plz suggest me where can i the path for report's query log file. i.e I run a webanalysis report and now i want to see the query that it fire to the source.
I want to see the detail level log.
Is there any other setting that i need to do like entry in property file or something.
Plz suggest the way.
ThanksCreate two env variables
ADM_TRACE_LEVEL=0
REDIRECTOR_TRACE_LEVEL=0
Also you can add this line to WA.prop file
LogQueries=true
Hope it hepls
Regards
CK -
I am trying create a query log file for an ASO cube. I have created the database.cfg file in the database directory and restarted the application. Then I run a few queries, and stop the application. Query log file (database.qlg) is not created. My database.cfg file looks like this:<BR>QUERYLOG [LOB]<BR>QUERYLOG LOGFILESIZE 2<BR>QUERYLOG TOTALLOGFILESIZE 1024<BR>QUERYLOG ON<BR><BR>Thanks
I am trying create a query log file for an ASO cube. I have created the database.cfg file in the database directory and restarted the application. Then I run a few queries, and stop the application. Query log file (database.qlg) is not created. My database.cfg file looks like this:<BR>QUERYLOG [LOB]<BR>QUERYLOG LOGFILESIZE 2<BR>QUERYLOG TOTALLOGFILESIZE 1024<BR>QUERYLOG ON<BR><BR>Thanks
-
Best way to print result of query to file from pl/sql?
If I have a query, let's say 'select * form my_table', what's the best way to print it to a file from pl/sql?
Do I have to create a cursor, go through each line, and use some file output function? Or is there some clever way to say 'print this query to file!'The rest of my procedure (the one generating the query itself) is in PL/SQL. So it needs to be done from there. Any tricks?
(What's paper? I meant 'write to file') -
Query for file version less than 10.0 does not return expected data
I'm trying to build a query for all PCs that have a version of Iexplore.exe in c:\windows\program files\ that is less than 10.0 . When I run the query it returns no data. When I change 10.0 in the query to 9.9 it returns files with version 10.xxx in
the results. Its as if it is seeing 10.0 as 1.0. Is this expected ?
select SMS_R_System.Name, SMS_R_System.ADSiteName, SMS_G_System_SoftwareFile.FileName, SMS_G_System_SoftwareFile.FileVersion from SMS_R_System inner join SMS_G_System_SoftwareFile on SMS_G_System_SoftwareFile.ResourceID = SMS_R_System.ResourceId where
SMS_G_System_SoftwareFile.FileName = "iexplore.exe" and SMS_G_System_SoftwareFile.FilePath = "C:\\program files\\internet explorer\\" and SMS_G_System_SoftwareFile.FileVersion < "9.9"It is because the values are not integer, they are a string. And therefore 1 is smaller then 9.
http://www.enhansoft.com/ -
Folks,
I've setup a query and this query is stored to file. I've specified the path but is it possible to have the name of the file being the date?
Regards,
MdZHI
Give me the file name that u r giveing
or for example say file name is ABCD
DATA: name(20) type c value 'ABCD'.
DATA: filename
CONCATENATE name sy-datum INTO filename.
and pass this filename as ur actual file name
Edited by: Rasheed salman on Nov 27, 2008 10:29 AM -
Hi,
I am running my sap query and saving automaticaly into a file by using the 'file store' option. But i am running in background. I can see the result in the spool but how can i create the result in a TXT file directly.
Thanks for your help.
Regards,
CesarYou have to give your application Path like "/USR/folder or /temp/filename.txt .. if you`re running in background .
you can see the paths using Tr. AL11
Thanks
Saquib -
Query on File() constructor parameter
I have a query on the File(String pathname) constructor.
Could anyone advise me why its parameter is the pathname? Is the pathname has included the file's name?
String mypahtname = "c:\\folder\\";
String myfilename = "abc.txt";
String mystring = mypathname + myfilename;
File myfile = new File(mystring);The above is working. However, the parameter is not the pathname. Why is it working?A File object in Java may point to either an actual file, or a directory. So the final member of the path String parameter may be either a file or directory.
Read the first paragraph here
http://java.sun.com/javase/6/docs/api/java/io/File.html -
Query on File Adapter - HeaderLine
Hi All,
I've a query related to FCC - header line for the following structure.
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Testxmlns:ns0="urn:test:file">
<Record>
<Record1><field1>X</field1><field2>B</field2></Record1>
<Record2><field2>C</field3><field4>D</field4></Record2>
<Record3><field3>E</field5></Record3>
</Record>
<Record>
<Record1><field1>K</field1><field2>L</field2></Record1>
<Record2><field2>M</field3><field4>N</field4></Record2>
<Record3><field3>O</field5></Record3>
</Record>
</ns0:MT_Test>
And the file output (after FCC) should be as follows, where H1, H2 and H3 are the headers and the rest are the file values.
H1,H2,H3
X;C;E
K;M;O
FCC Param is like: Record1.fieldSeparator = ; and Record1.headerLine = 1 and same for rest two. But the output file generated doesn't have the Header line generated. Please let me know the FCC setting for the same.
Thanks,
Joe.Joe,
The parameter should be Record1.addHeaderLine = 1([http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/frameset.htm]
Kind regards,
Koen -
Query log file location?
Is log file is created when query has completed execution, if yes plz tell its location.
Put a set timing on before executing the query in SQL *Plus like:
SQL> set timing on
SQL> select 1 from dual;
1
1
Elapsed: 00:00:00.00
To make trace on just do the following:
SQL> SET AUTOTRACE TRACEONLY
SQL> SELECT 1 FROM DUAL;
Elapsed: 00:00:00.01
Execution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=2 Card=1)
1 0 FAST DUAL (Cost=2 Card=1)
Statistics
1 recursive calls
0 db block gets
0 consistent gets
0 physical reads
0 redo size
419 bytes sent via SQL*Net to client
508 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
1 rows processed
SQL>
Regards
Edited by: Virendra.k.Yadav on Aug 20, 2010 2:37 AM -
Save result of clob query to file
What is the best way to export a clob to a file, as the result of a query?
I have something like:
select xmlelement( "big_clob", big_clob ).getclobval() as "result"
spool in sqlplus will corrupt the clob/xml-output because of spool line-breaking.
Can it been done in sqlplus 9.2.0.5?
What are the alternatives?I never found a way to get around the line-break issue at 32k so I resorted to a java program.
-
REST API Query for file Versions - current version
Hi,
I have referred to the list of API query options from this link:
https://msdn.microsoft.com/en-us/library/office/dn450841.aspx .
As described in the post, the query goes as below
url: "<app web url>/_api/SP.AppContextSite(@target)/web
/getfilebyserverrelativeurl('/Shared Documents/filename.docx')/versions
?@target='<host web url>'",
This does not return the current file version details. Is there a way to get those details in the same query or should we place another query to get the current version file details as below
url: "<app web url>/_api/SP.AppContextSite(@target)/web
/getfilebyserverrelativeurl('/Shared Documents/filename.docx')
Thanks,
MeenaHi Meena,
In FileVersion endpoint, it will only return the old versions of a file.
If you want to retrieve all versions(including) of a file, there will be a need to run another request for the current version only, though which might cause extra workload.
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Maybe you are looking for
-
I have a six year old lap top with an old OS and itunes 10. I backed up my i phone 4 on it. I got an I phone 5 and the version of Itunes compatible is not supported by the laptop. I installed itunes on a different computer and when trying to sync
-
Hi, We just installed our PI Dev box. I tried to create a BPM and save it , but i get a unexpected exception when i try to do that. I just put a receive and send step to rule out any problem still the same thing. BPM works fine in the Sandbox. Sandbo
-
Hi, Receently, some of our users experienced pdf attachment problem. The user sent a 4mb pdf attachment but after the mail was sent out it only showed 4k in sent item. When the recipient received the e-mail the attachment also showed 4kb and it can't
-
Java code to connect to remote windows machine from local machine
Hi, I have developed a code to connecting remote windows M/C from local M/C by using SSH2 (ganymed-ssh2-build209.jar) API. when I run the code its giving below error. Can any one please help me how to resolve it. And also please let me know, is there
-
Create and save a multipdf as folder name?
I have created a macro that takes all files in a folder and create a multi page pdf. But I want it to be saved as the folder name automaticly. How do I do?