How to read all files from a folder Diadem
Hello,
Can somebody tell me how to load automatic some .csv file form a folder to Data Portal in Diadem.
I do some tests and during this tests I record data ( .csv files), files that I load manual now (*FileNameGet command), but I want when the tests are done and I load the script, then atomatic to load the csv files, analyze and build the report.
Please advice me how can I do that.
Thank you
(Attached you have my program)
Solved!
Go to Solution.
Attachments:
scripts.zip 10 KB
Duplicate Post here:
http://forums.ni.com/ni/board/message?board.id=60&message.id=10467#M10467
David_L | Certified LabVIEW Architect
LabVIEW Tools Network | LabVIEW Tools Network Developer Center
Similar Messages
-
How to read the file from a folder.
Hi All,
How to read the file from a folder or directory from the non sap server / remote server.
Regards
Sathisopen dataset filename for input in text mode
encoding default.
filename is character type variable with the destination filename.
Edited by: Jino Augustine on Apr 19, 2010 1:31 PM -
How to Read all files inside resource Folder inside Jar?
I have a Jar file,,,, The program reads for resource files in the resource folder inside the Jar. I want my program to read all files inside this folder without knowing the names or the number of files in the folder.
I am using this to make an Applet easy to be updated with spicific files. I just want to add a file inside the resource folder and Jar the program and automatically the program reads what ever is in there!!
I used the File class to get all file names inside the resource folder. it works fine before Jarring the program. After I jar I recieve a URI not Herarichy Exception!!
File fold=new java.io.File(getClass().getResource(folder).toURI());
String[] files=fold.list();
I hope the question is clear!!How to get the directory and jar file that you class resides in:
// returns path and jarfile (ex: /home/mydir/my.jar)
public String getJarfileName()
// Get the location of the jar file and the jar file name
java.net.URL outputURL = YourClass.class.getProtectionDomain().getCodeSource().getLocation();
String outputString = outputURL.toString();
String[] parseString;
int index1 = outputString.indexOf(":");
int index2 = outputString.lastIndexOf(":");
if (index1!=index2) // Windows/DOS uses C: naming convention
parseString = outputString.split("file:/");
else
parseString = outputString.split("file:");
String jarFilename = parseString[1];
return jarFilename;
}If your my.jar was in /home/mydir, it will store "/home/mydir/my.jar" in jarFilename.
note: getLocation returns "file:/C:/home/mydir/my.jar" for Windows/DOS and "file:/home/mydir/my.jar" for windows, thus why I look for the first and last index of the colon so I can correctly split the string.
If you want to grab a file in the jar file and get an InputStream, do the following:
import java.io.*;
import java.util.Enumeration;
// jar stuff
import java.util.jar.*;
import java.util.zip.ZipEntry;
public class Jaris
private JarFile jf;
public Jaris(String jarFilename) throws Exception
try
jf = new JarFile(jarFilename);
catch (Exception e)
jf=null;
throw(e);
public InputStream getInputStream(String matchString) throws Exception
ZipEntry ze=null;
try
Enumeration resources = jf.entries();
while ( resources.hasMoreElements() )
JarEntry je = (JarEntry) resources.nextElement();
// find a file that matches this string from anywhere in my jar file
if ( je.getName().matches(".*\\"+matchString) )
String filename=je.getName();
ze=jf.getEntry(filename);
catch (Exception e)
throw(e);
InputStream is = jf.getInputStream(ze);
return is;
// for testing the Jaris methods
public static void main(String[] args)
try
String jarFilename=getJarfileName();
Jaris jis = new Jaris(jarFilename); // this is the string we got from the other method listed above
InputStream is=jis.getInputStream("myfile.txt"); // can be used for xml, xsl, etc
catch (Exception e)
// this is just a test, so we'll ignore the exception
}Happy coding! :)
Doc -
Read all Files from a Folder on Server
Hi,
Can anyone help me in finding if there's any way to read all files in a folder on the server?Any Function module or anything.
ThanksOn App server? Try this sample program.
report zrich_0001 .
data: begin of itab occurs 0,
rec(1000) type c,
end of itab.
data: wa(1000) type c.
data: p_file type localfile.
data: ifile type table of salfldir with header line.
parameters: p_path type salfile-longname
default '/usr/sap/TST/DVEBMGS01/data/'.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_path
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
format hotspot on.
write:/ ifile-name.
hide ifile-name.
format hotspot off.
endloop.
at line-selection.
concatenate p_path ifile-name into p_file.
clear itab. refresh itab.
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
read dataset p_file into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset p_file.
loop at itab.
write:/ itab.
endloop.
Regards,
Rich Heilman -
How to read .mdb file from shared folder
Hi All,
In one of my local computer I have a shared folder and within the folder I have a .mdb file. Now I am trying to read that file from MII. I have tried with Get_File_List action block. I am providing the following information to Get_File_List
Folder :
<Computer Name>\<Shared Folder Name>
Mask: .mdb
But in return of Get_File_List, I am not getting any file related information. It is only providing like below
<Rowsets>
<Rowset>
<Columns>
<Column Description="Name" MaxRange="0" MinRange="0" Name="Name" SQLDataType="1" SourceColumn="Name"/>
<Column Description="Date" MaxRange="0" MinRange="0" Name="Date" SQLDataType="93" SourceColumn="Date"/>
<Column Description="Size" MaxRange="100" MinRange="0" Name="Size" SQLDataType="4" SourceColumn="Size"/>
<Column Description="LastWriteDate" MaxRange="0" MinRange="0" Name="LastWriteDate" SQLDataType="93" SourceColumn="LastWriteDate"/>
<Column Description="ReadOnly" MaxRange="1" MinRange="0" Name="ReadOnly" SQLDataType="4" SourceColumn="ReadOnly"/>
<Column Description="FullPath" MaxRange="0" MinRange="0" Name="FullPath" SQLDataType="1" SourceColumn="FullPath"/>
</Columns>
</Rowset>
</Rowsets>
Can anybody suggest me how to achieve it.
Thanks in advance
ChandanHi Chandan,
Specify the mask as *.mdb and try.
Thanks,
Dipankar -
How to read all files under a folder directory in FTP site
Hi Experts,
I use this SQL to read data from a file in FTP site. utl_file.fopen('ORALOAD', file_name,'r');
But this need to fixed file name in a directory. However, client generate output file with auto finename.
SO do we have any way to read all file by utl_file.fopen('ORALOAD', file_name,'r');
We need to read all file info. because client claim for security issue and does not to overwirte output file name,
we must find a way to read all file in output directory.
Thanks for help!!!
JimIf you use Chris Poole's XUTL_FTL package, I believe that contains functions that allows you to query the directory contents.
http://www.chrispoole.co.uk/apps/xutlftp.htm
Edited by: BluShadow on Jan 13, 2009 1:54 PM
misread the original post -
How to move all files from a folder for a user to a centralized folder on a core server
Hello,
I'm curious if there is a batch file that can be made to move the contents that are setup like this....
I'm having to redo a TS cluster and I'd like to make a batch file script that can be executed that moves the contents of say 'jsmith's local desktop profile @ \\NGTTS1\users\jsmith to a centralized folder on our roaming desktop profile server that saves
all of the files for the desktops @ \\NGTFS1\users\jsmith.
The problem I have is no matter what I tell users to save there files to our Y drive that is a folder that is synced across all 6 of our TS servers, users still store files on there desktops, so as you can imagine if one day they are on one server, then
next day they could be on another and there files aren't the same.... hence the reason why I want to move all there files to the centralized server so when I redo the profiles from scratch on the TS server in the farm they suck files from the core server and
have all of the files they are used to having....
Now I know I can do this with a MOVE command I've just never done one to this exact.
Hopefully someone knows the command to move all the contents of one folder on one server to the folder on a different server. I've already got the bulk of the coding done of the .bat script I just don't know this move command:
would it be this:
move \\NGTTS1\users\jsmith *.* \\NGTFS1\users\jsmith
any help would be appreciated, I'm sure this is a easy command to do!
This is the coding I have so far....
@echo off
color 0A
title Moving Local Profile folder to Centralized Profile Folder on Core Server.
:start
echo Welcome, %USERNAME%
echo What would you like to do?
echo.
echo 1. Moving Local Profile folder to Centralized Profile Folder on Core Server
echo.
echo 0. Quit
echo.
set /p choice="Enter your choice: "
if "%choice%"=="1" goto Move-user-profiles
echo.
if "%choice%"=="0" exit
echo Invalid choice: %choice%
echo.
pause
cls
goto start
:Move-user-profiles
echo.
set /p profile="Enter user profile: "
move "\\NGTTS1\users\%profile%" *.* "\\NGTFS1\users\%profile%"
echo moving files from local profile folder to FS1 profile server, stand-by...
echo.
goto cancel-special
:cancel-special
set /p cancel="Type cancel to stop action: "
if not "%cancel%"=="cancel" exit
cls
echo Action is cancelled.
echo.
pause
exitIn Windows we would do this using Group Policy. There is a Policy setting that csn move the Desktop folder to any server you want to move it to. Once set it will automatically do this for you.
You should post in the Group Policy forum to find out how we use Group Policy to manage users profiles in Windows.
You cannot use a script to relocate a users Desktop folder. The desktop is locked by the time the users logon script is finished running. It the desktop and profile are already being managed by Group Policy then this can only be done with GP.
There are also numerous issues associated with deployment and re-deployment that you need to address Post your questions in the Winows Deployment forum to get assistance with deployment issues.
Again - want you are asking is not generally possible because of how Windows is designed. This would only likely work on a simple system or on a stand alone PC and then only under a very limited set of circumstances.
Use GP folder redirection to do this. For deployment use Deployment Forum and for TS specific issues post in the RDS forum.
All of this needs to be considered correctly for TS users inn a TS Cluster environment. (TS Cluster?? - not sure what you mean by that.
¯\_(ツ)_/¯ -
How to move all files from a folder for a user to a centralized folder on a core server with a GP
Hello,
I was curious if someone know how to move all the files of a user "local" profile on a Terminal Server to that of a centralized server where the "local" profile of like the user desktop, favorites, setting, etc are stored in the event
the local profile on the TS become corrupt it can pull from this server...
The problem I have is no matter what I tell users to save there files to our Y drive that is a folder that is synced
across all 6 of our TS servers, users still store files on there desktops, so as you can imagine if one day they are on one server, then next day they could be on another and there files aren't the same.... hence the reason why I want to move all there files
to the centralized server so when I redo the profiles from scratch on the TS server in the farm they suck files from the core server and have all of the files they are used to having....
So I was curious and I've heard from some this is possible in a GP, but I'd like to move the contents of all 6 TS for
each user or if I have to d this on per user basis I will, just looking for a way to move the files....Hi Trevor,
To move all users’ desktop to a server, we can use Folder Redirection to do this. The path for Folder Redirection is:
[Group Policy Object Name]\User Configuration\Policies\Windows Settings\Folder Redirection
In this situation, we can choose to redirect desktop to the root of a network file share or a folder on a network share.
Regarding how to configure this, the following article can be referred to for more information.
Configuring Folder Redirection
http://technet.microsoft.com/library/cc786749.aspx
Hope it helps.
Best regards,
Frank Shen -
how to move downloaded files from download folder to other relevant folder or how to download files in relevant folders other than download folder
Just drag the file from the Download folder to the folder of your choice in Finder. If you are using Safari you can designate a new default download destination in Safari>Preferences>General tab, 'Save Downloads to...'. Other browsers should have a similar option in their preferences.
-
How 2 read two files from 2 diff. directories, using single adapter
How 2 read two files from 2 diff. directories in same system, using single file adapter.
you can use advanced selection for source file
see
http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm -
i want to make a schedular probably in Coldfusion or using javascript , which read xml files from a folder ,import in Indesign template then export as a pdf....
I don't think you understand: I want to open Dreamweaver and build a brand new site, then when I am done I want to host the dreamweaver site on the Business Catalyst platform. I dont want to use anything in BC to build the site, I just want to use the hosting platform. I do not want to import a BC site into dreamweaver or anything like that. I just want to use BC the same way I would use godaddy, or uhost or any other hosting provider. Based on your response you said that "of course its possible to build a BC site in Dreamweaver" I dont want to build a BC site, I want to build a Dreamweaver site and host it on the BC platform. Like I said before it doesnt seem like this is possible. As of now we can only build a new site in MUSE and integrate it into BC without using a BC template. Can you understand what I am saying. I DONT WANT TO USE A BC TEMPLATE, I WANT NOTHING TO DO WITH BC WHILE I AM BUILDING THE SITE WITH DREAMWEAVER, JUST LIKE MUSE DOES.
-
Reading all files froma folder
Hi ,
Does anyone know how to read the data from all text files in a given folder?
I mean does text_io recongnises a certain sintax to do this?
Thanks,
SanduWell
I'm having problems initializing a java.lang.String as ora_java.jobject.
I was able to import in forms my class ,(wich works ok when tested like standalone java class,it returns all the filenames from a folder),a package was generated on the form for it.
But,I've got to pass it the folder name as a String.
I've imported java.lang.String as ora_java.jobject,and a package was generated on the form.
When I try to call string.new('c:\work');
it won't compile,it says invalid reference to variable String.
What should I do?Is there any predefined Type in ora_java package for java.lang.String?
Thanks,
Sandu -
How use PHP to read image files from a folder and display them in Flex 3 tilelist.
Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code
PHP :
PHP Code:
<?php
//Open images directory
$imglist = '';
$dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");
//List files in images directory
while (($file = $dir->read()) !== false)
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
echo "filename: " . $file . "\n";
$dir->close();
?>
FLEX 3 :
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.events.ItemClickEvent;
import mx.rpc.events.ResultEvent;
public var image:Object;
private function resultHandler(event:ResultEvent):void
image = (event.result);
ta1.text = String(event.result);
private function faultHandler(event:FaultEvent):void
ta1.text = "Fault Response from HTTPService call:\n ";
]]>
</mx:Script>
<mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}" width="630" height="149"/>
<mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>
<mx:HTTPService id="pic" url="{phpPicture}" method="POST"
result="{resultHandler(event)}" fault="{faultHandler(event)}"/>
<mx:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>
<mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>
</mx:Application>
Thanks. Need help as soon as possbile. URGENT.i have made some changes, in the php part too, and following is the resulting code( i tried it, and found that it works.):
PHP Code:
<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<root>
<images>
<?php
//Open images directory
$dir = dir("images");
//List files in images directory
while (($file = $dir->read()) !== false)
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
echo "<image>" . $file . "</image>"; // i expect you to use the relative path in $dir, not C:\..........
//$dir->close();
?>
</images>
</root>
Flex Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="callPHP();">
<mx:Script>
<![CDATA[
import mx.rpc.http.HTTPService;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.events.ItemClickEvent;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var arr:ArrayCollection = new ArrayCollection();
private function callPHP():void
var hs:HTTPService = new HTTPService();
hs.url = 'Picture.php';
hs.addEventListener( ResultEvent.RESULT, resultHandler );
hs.addEventListener( FaultEvent.FAULT, faultHandler )
hs.send();
private function resultHandler( event:ResultEvent ):void
arr = event.result.root.images.image as ArrayCollection;
private function faultHandler( event:FaultEvent ):void
Alert.show( "Fault Response from HTTPService call:\n " );
]]>
</mx:Script>
<mx:TileList id="tilelist"
dataProvider="{arr}">
<mx:itemRenderer>
<mx:Component>
<mx:Image source="images/{data}" />
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:Application> -
Hello!
Here's the question with explaniation: How can i format the USB or Drive by clicking a button what's meant for it?
and the second question what's also in vb.net: How can i remove all files from folder ?
Here's the Look of program: *
Using the PC button, it will delete the free space of the PC, do you guys/girls know where it's location?Example Code:
Imports System.Runtime.InteropServices
Imports System.IO
Public Class Form1
Dim CBoxDrives As New ComboBox
WithEvents FButton As New Button
<DllImport("shell32.dll")> _
Private Shared Function SHFormatDrive(ByVal hwnd As IntPtr, ByVal drive As UInteger, _
ByVal fmtID As UInteger, ByVal options As UInteger) As ULong
End Function
Private Enum SHFormatFlags As Integer
SHFMT_ID_DEFAULT = &HFFFF
SHFMT_OPT_FULL = &H1
SHFMT_OPT_SYSONLY = &H2
SHFMT_ERROR = &HFFFFFFFF
SHFMT_CANCEL = &HFFFFFFFE
SHFMT_NOFORMAT = &HFFFFFFD
SHFD_FORMAT_FULL = 0 ' full format
SHFD_FORMAT_QUICK = 1 ' quick format
End Enum
Private Sub FButton_Click_1(sender As System.Object, e As System.EventArgs) Handles FButton.Click
If CBoxDrives.Text = "" Then
MsgBox("No Drive Selected")
Exit Sub
End If
Dim Iresult As ULong = SHFormatDrive(CType(Me.Handle.ToInt32, IntPtr), CUInt(Asc(CBoxDrives.Text.Substring(0, 1)) - Asc("A")), CUInt(SHFormatFlags.SHFMT_ID_DEFAULT), 1)
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Size = New Size(200, 100)
With FButton
.Size = New Size(50, 25)
.Location = New Point(5, 5)
.Text = "Format"
End With
Me.Controls.Add(FButton)
With CBoxDrives
.Size = New Size(50, 25)
.Location = New Point(75, 5)
.DropDownStyle = ComboBoxStyle.DropDown
End With
Me.Controls.Add(CBoxDrives)
Dim DrivesFound As Integer = 0
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Dim d As DriveInfo
For Each d In allDrives
If ((d.DriveType = DriveType.Fixed) Or (d.DriveType = DriveType.Removable)) AndAlso Environment.GetEnvironmentVariable("SYSTEMROOT").StartsWith(d.Name) = False Then
CBoxDrives.Items.Add(d.Name)
DrivesFound += 1
End If
Next
CBoxDrives.SelectedIndex = DrivesFound - 1
End Sub
End Class -
Reading a file from a folder.
Hi everyone,
I am trying to modify my first java program.
The method below is used to read a file that is hard coded in the below method. What I would like it to do is to pick up files that are stored in a folder. The reason for this is that the file names will never be the same.
I am unsure how to do this and would appreciate some help from you.
Thanks in advance.
public void fileBreakdown()
try
FileReader file = new FileReader("files/myTextFile.txt");
BufferedReader buffer = new BufferedReader(file);
String textline = null;
ArrayList arr = new ArrayList();
while ((textline = buffer.readLine()) != null)
boolean syswarnEndFound = false;
if((textline.substring(45, 52)).equals("SYSWARN"))
System.out.println(textline.substring(45, 52));
arr.add(textline);
while ((textline = buffer.readLine()) != null && !syswarnEndFound)
if(textline.indexOf("}") == -1)
//System.out.println("not found : " + textline);
buffer.mark(1000);
arr.add(textline);
else
//System.out.println("found");
syswarnEndFound = true;
buffer.reset();
OutputFileTypes.processSYSWARN(arr);
else if((textline.substring(45, 51)).equals("SYSMSG"))
System.out.println("Stopped, program ends");
System.out.println(textline.substring(45, 51));
arr.add(textline);
while ((textline = buffer.readLine()) != null && !syswarnEndFound)
if(textline.indexOf("}") == -1)
buffer.mark(1000);
arr.add(textline);
else
syswarnEndFound = true;
buffer.reset();
OutputFileTypes.processSYSMSG(arr);
else
String[] messageArr = textline.split(" ");
Processing.whichFileType(getSubject(messageArr),getMessage(messageArr),getPublishedDate(messageArr));
getPublishedDate(messageArr);
buffer.close();
catch( IOException e) {System.out.println(e);}
}I could not compile your code. But if you wanted to get all .txt files from a folder then you could do something like this
class EndsWith implements FilenameFilter {
String ext;
public EndsWith(String ext) {
this.ext = "." + ext;
public boolean accept(File dir, String name) {
return name.endsWith(ext);
public static void main(String args[]) {
String srcDir="C:/temp/";
try {
File srcFiles = new File(srcDir);
FilenameFilter filteredFiles = new EndsWith("txt");
String sourceDir[]=srcFiles.list(filteredFiles);
for(int i=0;i<sourceDir.length;i++)
String fileName = srcDir+sourceDir;
System.out.println(fileName);
FileReader file = new FileReader(fileName);
//..your code here
}catch(IOException ioe) {
ioe.printStackTrace();
NOTE: I haven't tested this code. You can give a try.
Maybe you are looking for
-
I'm missing the back cover and flap for my book in the layout interface. Does anyone know how to restore these? I've searched the interface but can't find an option to add cover/flap. Don't want to order a book without it. Any advice is welcome!
-
A client has two sets of publications - a weekly and a monthly. We ideally want to build an Enterprise app that houses all their weekly and monthly publications. Both products need to appear in Newsstand. Is this possible? If so, how do we partition
-
Red Giant's DeNoiser II in Premiere CS6?
I usually use Neat Video but I do not own the Premiere version so I thought I'd give Red Giant's noise reduction a try. I'm impressed with the quality but find that with a few instances of the plugin on clips Premiere slows so much that just making
-
Using Assembler to extract links from a file contained in a package
Hi everyone, I need help creating a DDX file that would extract links from the second file in a package. Can you point me to some examples somewhere? The file has links to other files in the package. It doesn`t work when I remove it from the package,
-
PDF saving problem CS6- empty document
Hello, can someone help me saving on my cs6 indesign to PDF? I've been having problems with it, the images sometimes do not apear, or it marks a mistake, and after i close it, its ok. My real problem is that I did my thesis on InDesign, its about 180