How to list/read all files in a folder
actually i want to list all the files/folders in a specified
folder on server.
please somebody suggest me how can I.
ya actually i realize the scenario now.
i work on flex with php.
i'm going to do it with php now.
but if i want to develop a desktop application with flex (
actually i'm thinking of a photo gallery) without PHP/XML ( or
other headaches for programming illiterates ) so that they simply
put my swf application in their my pictures folder and enjoy it, I
CANT DO IT RIGHT?????
so SAD..... :(
Similar Messages
-
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 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 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 KBDuplicate 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 -
I have a large set of data. Many don't have similar names at all. They
all have the same data form (a 100x2 array for example).
Is there a way to have a VI read all the files, one after another,
automatically? It's a lot easier when the files are the same name, but
ending/starting with different ID numbers. If they're all different,
what can I do?
Also, is it possible to create a VI, so that a file 'dropped' onto the
VI's icon, will cause it to process the data? I'm not sure if this is
a Labview or MS Windows problem.
Thank you for your time.
-Dorian
[email protected]
Please post if possible, to share.Dorian;
You can simplify this if all your files are in the same directory. Check the example attached that read all .jpg images in a directory and display them in a picture control. Enter the directory path before running.
As for your second question, it can be done, but I think (I might be wrong) that you must convert your vi into an executable. Check the following example:
Get Calling File Path from Command Line
Best regards;
Enrique
www.vartortech.com
Attachments:
image_show.vi 24 KB -
How to move my all files to one folder
hi, I had created different folders in the acrobat.com. Now, I want to move all my files from all the folders to a different folder. How can I do this? there is not copy or move options available. Please help..
Just to clarify, the above answer is for Workspaces (url is workspaces.acrobat.com), which is the legacy form of Acrobat.com. It should also be noted, to move files in workspaces, you can simply drag/drop files to the folder you want to move them to. You can select multiple files using control + shift key or control+A to select all
However, if you are referring to the cloud storage solution Acrobat.com (url is files.acrobat.com):
Select the files you want to move
After selecting the file(s) a tool bar will display
Click on the Move tool and choose your destination folder in the move dialog
For more information regarding Workspaces and Files.Acrobat.com, see http://forums.adobe.com/docs/DOC-3391 -
10.6.4: how to unlock all files in a folder
hi,
how do you unlock all files inside a folder?
thank you..thank you.. (I wonder why you can't just do it by getting info on the folder, then saying, unlock all files inside.. (u can do like that in windows) this is always more practical than having to select all files (and accidentally opening them, or something...-) in windows you can select a folder and then say, (un)lock all files and and dirs -- and subdirs and files inside -- inside this folder.. can u do something like this in mac os? if not, that's not very good.. (I guess on the mac would need to find unix commands for doing something like this..)
they really need to consider this for future versions, this is a no-brainer...;-)
thank you.. -
Read All files in folder and sub folder
Hi,
i can read files in a folder,but not in a sub folders.can any one give me idea to read all files in the folder and its sub folder.
DeepanHi
This code may help you
Bliz
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
public class CountFiles {
* @param args
* @throws IOException
* Count files in <path> and all its subDirs
public static String path = "c:";
public static String src1 = "";
public static FileChannel channel;
public static int numF;
public static int numD;
public static void main(String[] args) throws IOException {
countFiles(path);
System.out.println("Number of files :\t"+numF);
System.out.println("Number of dirs :\t"+numD);
public static void countFiles(String strPath) throws IOException
File src = new File(strPath);
if (src.isDirectory())
numD++;
String list[] = src.list();
try {
for (int i = 0; i < list.length; i++)
src1 = src.getAbsolutePath() + "\\" + list;
File file = new File(src1);
try {
channel = new RandomAccessFile(file, "r").getChannel();
}catch(java.io.FileNotFoundException e){}
countFiles(src1);
}catch(java.lang.NullPointerException e){}
else
numF++; -
How to read list of all files in folder on application server?
How to read list of all files in folder on application server?
Hi,
First get the files in application server using the following function module.
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
name = loc_fdir
TABLES
file_tbl = int_filedir.
Here loc_fdir contains the application server path.
int_filedir contains all the file names in that particular path.
Now loop at int_filedir.
OPEN DATASET int_filedir-name FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE wf_mess.
MESSAGE wf_mess.
IF sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
endif.
close datset int_filedir-name.
endloop. -
How to Delete Multiple/All Files in Reader
How to Delete Multiple/All Files in Reader on iPad3?
Read this:
http://forums.adobe.com/thread/1012973?tstart=0 -
Newbie question - How to read all files for a backup
Hello all,
I have two users on my iMac. I am an administrator and the other user is a Standard user.
From my account, I wish to run backup software that will backup the entire "User" directory. The problem I am having is that when I run the backup software (fyi: iBackup),
it complains that it cannot read the files in the other user's account.
I notice that when I browse to the other user's account, all the directories in their home folder are locked.
How can I run my backup software so that it can read all files in the User directory?
Thank you kindly!
Jeff
17" iMac Core Duo Mac OS X (10.4.6)Hi kneecarrot !
I don't know if this will suit your needs, but one easy way of backing up other user's stuff is via the terminal . If you have an admin accountm just use:
sudo ditto -rsrcFork /Users /Volumes/"nameof_anotherharddrive"/Users
This will perform an identical clone of all your users home direcories for backup purposes. To restore the bkd'up files, just reverse the lines:
sudo ditto -rsrcFork /Volumes/"nameof_anotherharddrive"/Users /Users
ATTENTION: Be aware that it will restore the files to the exact structure and contents it was when backed up, erasing all new and modified files!! You may however copy just the files/folders you want to recover, e.g.:
sudo ditto -rsrcFork /Volumes/"nameof_another_harddrive"/Users/"usera"/Documents /Users/"user_a"/Documents
IMPORTANT: As with all terminal commands... be careful, think twice and double-check the syntax. You may want to test with non-critical stuff or demo user accounts first.
Good luck,
Michael
MacBook Pro Mac OS X (10.4.6) 2 Gig RAM -
How Can I Find a Listing of ALL Files in a Particular Logic Pro 7.2 Song?
Hello,
Is there a quick and easy way to find a listing of all files that belong to a particular Logic Pro 7.2 song? I am trying to clean up my Logic folder that has no hierarchical order with files in their respective song folder. Just a littering of files that belong to various songs.
Thanks
TonyProject Manager
Consolidate files of selected songs while using copy on all should do it all for you, but create a lot of redundant data if your sessions share many files. It's safer though.
J -
I need to back up my imac running Tiger (no time machine) so that we can upgrade OS. It is set up for multiple accounts. How do I capture all files in each account using newly purchased USB external hard drive? Thanks!
Backup Software Recommendations
Carbon Copy Cloner
Data Backup
Deja Vu
SuperDuper!
Synk Pro
Tri-Backup
Others may be found at VersionTracker or MacUpdate.
Visit The XLab FAQs and read the FAQ on backup and restore. Also read How to Back Up and Restore Your Files.
Or you can simply use the Restore option of Disk Utility to clone the drive to the backup:
Clone using Restore Option of Disk Utility
Open Disk Utility from the Utilities folder.
Select the destination volume from the left side list.
Click on the Restore tab in the DU main window.
Check the box labeled Erase destination.
Select the destination volume from the left side list and drag it to the Destination entry field.
Select the source volume from the left side list and drag it to the Source entry field.
Double-check you got it right, then click on the Restore button.
Destination means the external backup drive. Source means the internal startup drive. -
Reading All Files inside folder codeBase, Applet!
I have an applet, placed in a Jar file.. everything is ok,,
I have a resource folder outside the Jar, which has some files.
how can I read what is inside the resource folder, which is located outisde the Jar, without having their addresses before hand!!
in short, I would like the applet to open the resource folder, get an array of all files in the folder, and then reads them.
I tried encapsulating the getCodeBase().toURI() with a File Object.
But when I call the file.list() it throws an AccessControlException
thank you.Here is a simple example of using ftp to obtain file list using Jakarta common net package.
// ftp - related imports
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPReply;
// main method
FTPClient ftpClient = null;
try {
ftpClient = new FTPClient();
ftpClient.connect("REMOTE_HOST", "remote port, use 21 in common case");
System.out.print(ftpClient.getReplyString());
int reply = ftpClient.getReplyCode();
if(!FTPReply.isPositiveCompletion(reply)) {
ftpClient.disconnect();
System.err.println("FTP server refused connection.");
System.exit(1);
boolean isLoggedIn = ftpClient.login("your login", "your pass");
ftpClient.changeWorkingDirectory("/your remote dir/");
String[] fNames = ftpClient.listNames();
for (int i = 0; i < fNames.length; i++) {
System.out.println(fNames);
ftpClient.logout();
} catch (IOException e) {
e.printStackTrace();
} finally {
if(ftpClient.isConnected()) {
try {
ftpClient.disconnect();
} catch(IOException ioe) {
ioe.printStackTrace();
System.exit(0);
Maybe you are looking for
-
What exact date can I install the new ios 7 update on my iphone 5?
I Want the new ios7 that everyone is talking about & so many people have it on YouTube & a lot of people are say there's different versions? I just want to know what date the 'Apple iOS 7 Update' is released to the public in Australia.
-
Identity Service Engine (ISE) Admin Access
Is it possible to authenticate the ISE administrator via an external Radius Server? The option I find is that it will not work, The manual reads: In Cisco ISE, you can authenticate administrators via an external identity store such as Active Direct
-
System crash loading particular project
System: OS Name Microsoft Windows XP Professional Version 5.1.2600 Service Pack 3 Build 2600 System Manufacturer Hewlett-Packard System Model HP EliteBook 8730w Processor x86 Family 6 Model 23 Stepping 6 GenuineIntel ~2527 Mhz Total Physical Memory 4
-
What does "Illegal Constant Pool Type" error signify ?
Hello, I have developed an application on a windows system that connects to a database, places values onto an object, and displays on a screen. When I run on a windows environment everything works fine. When I export to my external server, which is l
-
Photoshop CC already installed, CC still offers to download/install
I have been using Photoshop CC (Photography bundle) for several months now. When I use the Update option, it sends me to the Adobe Application Manager, which offers me updates on... CS6 applications!!! Then, if I open CC, I am offered to install Phot