Plsql utility to traverse directory to list all the files
Hi All?
Anybody know of anyway to traverse a directory and list the files under that directory?
Thanks
Rgds
Ung
Do you want the directory and files on the server or
the client?On the server.
Similar Messages
-
How to list all the files in a FTP site?
I am now using LV7.1 and trying to list all the files (with file name, file size and modified date) on both a local drive and a remote FTP site. I can manage to do on a local drive, but is it possible to list the files on a FTP site?
Thanks,
ColaListing files on a local drive and listing the contents of an ftp site are two different things. Access to an ftp site uses a totally different protocol. Off the top of my head, you have a few options:
Use a third-party tool that can map an ftp drive to a local drive letter. WebDrive is one such client. Note: I'm assuming Windows here.
Use the Intenet Toolkit.
Use the LabVIEW TCP/IP functions to write up your own ftp client to connect to the server, change to the desired directory, and send the command to list the contents, which you can parse and spit out as a nice little array of filenames. Check the LabVIEW examples, as I believe there's some examples on this. You should also search this board for "ftp client", as this has been brought up before, and samples have been posted. -
Hi,
I would like to know whether FLASH AS3 has some option to get all the files names from a folder specified and show it in a dynamic text box? Whenever some new files added to this folder it should update the list accordingly.
Thanks for any information in this regard.Not particularly experienced in this field myself, but I've found its just easier to implement an XML file which lists the contents of the folder. It just means that when you upload a new file you have to add it to the list in the xml file also. No real hardship once you figure out the mechanics of it
-
SMB sharing not listed all the files
Folks,
We've got a G5 desktop machine running 10.5.8. It had been sharing a RAID array -- Buffalo DuoStation, 2tb, mounted with Firewire -- with AFP for some time, and apparently that had been working fine.
But the AFP sharing didn't show up in file sharing at all. We had to set up Windows/SMB sharing, turned it on, it came up just fine.
Except a huge number of the folders are simply not showing up -- like, a majority. Sharing is set to everyone read-only. It's a photo archive, so I can see every day for 2011, but I can't see any of the months for, say, 2005. Only thing that shows is .DS_Store is in the second-level folders.
Because this is already in production, and I don't know the RAID setup or anything, I'm reluctant to try to run Drive Setup etc. on it to look for permission problems and the like.
Any ideas?
MikeI thought the problem was ACLs, but it was a directory name problem -- and I just completely overlooked it.
We had folders like this:
2005 photos
-> 01/05
->-> 01/13/05
The slashes are outside the SMB specs, so they simply didn't show. Now I guess I need to find a way to rename the folders in bulk, but I know what the problem is. -
FileSelectPopup in LW/CVI not listing all directories/files in linux.
This is concerning a port of Windows based software to Linux. The FileSelectPopup dialog does not list all the files and folders in the current directory. For example, if I look in /home/pshrewsberry I can see everything but when look in /home I cannot see pshrewsberry! Another example: If I am in a directory "test" which contains directories A,B,C and D only B and D are listed. The same happens with files as well: In the FileDialogTest directory that I have attached to this post when I browse this directory using FileSelectPopup I can't see the cvibuild.FileDialogTest directory (created after building) nor can I see the binary "FileDialogTest".
This problem does not happen in all directories that I browse through either. I can't seem to find a rhyme or reason to it. File permissions on all files in FileDialogTest (for example) are the same and UID and GID are same as well but the FileDialogTest binary and the cvibuild.FileDialogTest directory are not listed. If I run as root I get the same results.
I have tested this in Linux with LW/CVI8 and the LW/CVI 2010 beta and I get the same erroneous results with both.
Could this be a bug in LW/CVI for linux?
Thanks
-pete
Attachments:
FileDialogTest.tgz 4 KBI'm not sure how to track a corrective action request.
What is the timeframe for this to make it into a beta or a distro. I just went throught this before concerning another problem that I found. We ultimately received an updated shared object file (*.so) to fix the issue before the ultimate release of fix in beta. That resolution is preferable for this issue as opposed to waiting for the next official update.
Thanks,
-pete -
How to list all the Fields for an Active Directory Object
How do I list all the fields that an Active Directory object contains? I know the most common ones, but would like to enumerate through all the fields and obtain the type of fields and their values...
Here is my complete code - I only put snippets so that the post was not too huge...
Option Explicit
Const ADS_SCOPE_SUBTREE = 2
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim adoCommand, adoConnection, adoRecordSet
Dim dtmDate, dtmValue
Dim j
Dim lngBias, lngBiasKey, lngHigh, lngLow, lngValue
Dim objADObject, objClass, objDate, objFile, objFSO, objRootDSE, objShell
Dim pathToScript
Dim strAdsPath, strConfig, strDNSDomain, strHex, strItem, strProperty, strValue
Dim strFilter, strQuery
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
pathToScript = objShell.CurrentDirectory
Set objFile = objFSO.CreateTextFile(pathToScript & "\TestAD.csv")
' Determine Time Zone bias in local registry.
' This bias changes with Daylight Savings Time.
lngBiasKey = objShell.RegRead("HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias")
If (UCase(TypeName(lngBiasKey)) = "LONG") Then
lngBias = lngBiasKey
ElseIf (UCase(TypeName(lngBiasKey)) = "VARIANT()") Then
lngBias = 0
For j = 0 To UBound(lngBiasKey)
lngBias = lngBias + (lngBiasKey(j) * 256^j)
Next
End If
' Determine configuration context and DNS domain from RootDSE object.
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfig = objRootDSE.Get("configurationNamingContext")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection
adoCommand.CommandText = "SELECT * FROM 'LDAP://" & strDNSDomain & "'WHERE objectClass=user'"
adoCommand.Properties("Page Size") = 1000
adoCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set adoRecordSet = adoCommand.Execute
Set adoRecordSet = adoCommand.Execute
adoRecordSet.MoveFirst
Do Until adoRecordSet.EOF
strAdsPath = adoRecordSet.Fields("ADsPath").Value
' Bind to Active Directory object specified.
Set objADObject = GetObject(strAdsPath)
Set objClass = GetObject(objADObject.Schema)
' Write which object is grabbed from AD
objFile.Write(Replace(strAdsPath, ",", ";;;"))
' Enumerate mandatory object properties.
For Each strProperty In objClass.MandatoryProperties
On Error Resume Next
strValue = objADObject.Get(strProperty)
If (Err.Number = 0) Then
On Error GoTo 0
If (TypeName(strValue) = "String") Or (TypeName(strValue) = "Long") Or (TypeName(strValue) = "Date") Then
objFile.Write("," & strProperty & "|||" & Replace(CStr(strValue), ",", ";;;"))
ElseIf (TypeName(strValue) = "Byte()") Then
strHex = OctetToHexStr(strValue)
objFile.Write("," & strProperty & "|||" & CStr(strHex))
ElseIf (TypeName(strValue) = "Variant()") Then
For Each strItem In strValue
On Error Resume Next
objFile.Write("," & strProperty & "|||" & Replace(CStr(strItem), ",", ";;;"))
If (Err.Number <> 0) Then
On Error GoTo 0
objFile.Write("," & strProperty & "|||Value cannot be displayed")
End If
On Error GoTo 0
Next
ElseIf (TypeName(strValue) = "Boolean") Then
objFile.Write("," & strProperty & "|||" & CBool(strValue))
Else
objFile.Write("," & strProperty & "|||Type:" & TypeName(strValue))
End If
Else
Err.Clear
sColl = objADObject.GetEx(strProperty)
If (Err.Number = 0) Then
For Each strItem In sColl
objFile.Write("," & strProperty & "|||" & CStr(strItem))
If (Err.Number <> 0) Then
objFile.Write("," & strProperty & "|||Value cannot be displayed")
End If
Next
On Error GoTo 0
Else
Err.Clear
Set objDate = objADObject.Get(strProperty)
If (Err.Number = 0) Then
lngHigh = objDate.HighPart
If (Err.Number = 0) Then
lngLow = objDate.LowPart
If (lngLow < 0) Then
lngHigh = lngHigh + 1
End If
lngValue = (lngHigh * (2 ^ 32)) + lngLow
If (lngValue > 120000000000000000) Then
dtmValue = #1/1/1601# + (lngValue / 600000000 - lngBias) / 1440
On Error Resume Next
dtmDate = CDate(dtmValue)
If (Err.Number <> 0) Then
objFile.Write("," & strProperty & "|||<Never>")
Else
objFile.Write("," & strProperty & "|||" & CStr(dtmDate))
End If
Else
objFile.Write("," & strProperty & "|||" & FormatNumber(lngValue, 0))
End If
Else
objFile.Write("," & strProperty & "|||Value cannot be displayed")
End If
Else
On Error GoTo 0
objFile.Write("," & strProperty)
End If
On Error GoTo 0
End If
End If
Next
' Enumerate optional object properties.
For Each strProperty In objClass.OptionalProperties
On Error Resume Next
strValue = objADObject.Get(strProperty)
If (Err.Number = 0) Then
On Error GoTo 0
If (TypeName(strValue) = "String") Then
objFile.Write("," & strProperty & "|||" & Replace(CStr(strValue), ",", ";;;"))
ElseIf (TypeName(strValue) = "Long") Then
objFile.Write("," & strProperty & "|||" & Replace(CStr(strValue), ",", ";;;"))
ElseIf (TypeName(strValue) = "Date") Then
objFile.Write("," & strProperty & "|||" & Replace(CStr(strValue), ",", ";;;"))
ElseIf (TypeName(strValue) = "Byte()") Then
strHex = OctetToHexStr(strValue)
objFile.Write("," & strProperty & "|||" & CStr(strHex))
ElseIf (TypeName(strValue) = "Variant()") Then
For Each strItem In strValue
On Error Resume Next
objFile.Write("," & strProperty & "|||" & Replace(CStr(strItem), ",", ";;;"))
If (Err.Number <> 0) Then
On Error GoTo 0
objFile.Write("," & strProperty & "|||Value cannot be displayed")
End If
On Error GoTo 0
Next
ElseIf (TypeName(strValue) = "Boolean") Then
objFile.Write("," & strProperty & "|||" & CBool(strValue))
Else
objFile.Write("," & strProperty & "|||Type:" & TypeName(strValue))
End If
Else
Err.Clear
sColl = objADObject.GetEx(strProperty)
If (Err.Number = 0) Then
For Each strItem In sColl
objFile.Write("," & strProperty & "|||" & CStr(strItem))
If (Err.Number <> 0) Then
objFile.Write("," & strProperty & "|||Value cannot be displayed")
End If
Next
On Error GoTo 0
Else
Err.Clear
Set objDate = objADObject.Get(strProperty)
If (Err.Number = 0) Then
lngHigh = objDate.HighPart
If (Err.Number = 0) Then
lngLow = objDate.LowPart
If (lngLow < 0) Then
lngHigh = lngHigh + 1
End If
lngValue = (lngHigh * (2 ^ 32)) + lngLow
If (lngValue > 120000000000000000) Then
dtmValue = #1/1/1601# + (lngValue / 600000000 - lngBias) / 1440
On Error Resume Next
dtmDate = CDate(dtmValue)
If (Err.Number <> 0) Then
objFile.Write("," & strProperty & "|||<Never>")
Else
objFile.Write("," & strProperty & "|||" & CStr(dtmDate))
End If
Else
objFile.Write("," & strProperty & "|||" & lngValue)
End If
Else
objFile.Write("," & strProperty & "|||Value cannot be displayed")
End If
Else
On Error GoTo 0
objFile.Write("," & strProperty & "||| ")
End If
On Error GoTo 0
End If
End If
Next
objFile.WriteLine("")
adoRecordSet.MoveNext
Loop
objFile.Close
' Function to convert OctetString (Byte Array) to a hex string.
Function OctetToHexStr(arrbytOctet)
Dim k
OctetToHexStr = ""
For k = 1 To Lenb(arrbytOctet)
OctetToHexStr = OctetToHexStr _
& Right("0" & Hex(Ascb(Midb(arrbytOctet, k, 1))), 2)
Next
End Function
I have been able to obtain all the Computer, Contact, Group and OU objects without issue with this code... -
Making a list of all the files in a directory
I have a simple little plotting program that I would like to give the following functionality:
I'd like the user to be able to select a directory (folder) containing several text files (as well as possibly other files and/or folders). The app should identify which files in the selected directory are text files and then do something with the information in each of those files. I have no problems allowing the user to select one file at a time, but I can't figure out how to have my cocoa app sort through a directory and pull out the files it needs.
If someone could at least point me to an example somewhere on the dev site that would be awesome. I've searched for "working with files", "working with directories", "file wrappers", etc. and can't seem to find a way to do this!Thank you! I don't know why I couldn't find this when searching the help documentation.
-
How can I list all the domains configured for Weblogic Servers?
How can I list all the domains configured for Weblogic Servers?
I saw a note, which says the following:
"WebLogic Server does not support multi-domain interaction using either the Administration Console, the weblogic.Admin utility, or WebLogic Ant tasks. This restriction does not, however, explicitly preclude a user written Java application from accessing multiple domains simultaneously."
In my case, I just want to list all the domains, is that possible by using any scripts?
Thanks
AJIf you use WLS Node Manager and the Config Wizard was used to create the domains, then the list of domains should be in a location like this:
<MIDDLEWARE_HOME>\wlserver_10.3\common\nodemanager\nodemanager.domains
Enterprise Manager Grid Control also has support for multi-domain management of WLS in a console. -
Recursively Retrieving All the Files/Directories in a Directory
Hello,
I want to retrieve all files in a directory, and ran into this sample code:
www.ni.com/example/27157/en/
This is the function that does the retrieve action: GetFilesAndDirectories(). Its content is as follow:
void GetFilesAndDirectories(char dir[], int* numItems, int parentItem)
char fileName[MAX_PATHNAME_LEN], searchPath[MAX_PATHNAME_LEN];
int error = 0;
strcpy (searchPath, dir);
strcat (searchPath, "\\*");
if (!GetFirstFile (searchPath, 1, 1, 0, 0, 0, 0, fileName)) // has at least one file
InsertListItem (panelHandle, PANEL_LISTBOX, -1, fileName, (*numItems)++);
while (!GetNextFile (fileName))
InsertListItem (panelHandle, PANEL_LISTBOX, -1, fileName, (*numItems)++);
if (!GetFirstFile (searchPath, 0, 0, 0, 0, 0, 1, fileName)) // has at least one directory
char dirNamesSaved[MAX_NUM_DIR][MAX_PATHNAME_LEN];
int numDir = 0, i;
strcpy (dirNamesSaved[numDir++], fileName);
while (!GetNextFile (fileName) && numDir<MAX_NUM_DIR) // first save all the directory names
strcpy (dirNamesSaved[numDir++], fileName);
for (i=0; i<numDir; i++)
char displayName[MAX_PATHNAME_LEN];
Fmt (displayName, "%s<%s%s", fileName, " (Directory)");
InsertListItem (panelHandle, PANEL_LISTBOX, -1, displayName, (*numItems)++);
MakePathname (dir, dirNamesSaved[i], searchPath);
GetFilesAndDirectories(searchPath, numItems, (*numItems)-1);
I then modify that function into one that I can use to retrieve either files or folders, and populate a ring object with the result. I call it Ring_Populate(). Its content is as follow:
void Ring_Populate (int panel, int TargetRing, char TargetFolder[], int Directory_Bool, int *Iteration_Now, int Iteration_Prev)
char FileName [260]; //standard = 260 max char. w/ null char.
char Folder [260];
strcpy (Folder, TargetFolder); //copy string
strcat (Folder, "*"); //add wildcard character, * or ?
switch (Directory_Bool)
case 0: //file
if (!GetFirstFile(Folder, 1, 1, 0, 0, 0, 0, FileName)) //has at least 1 file
InsertListItem (panel, TargetRing, -1, FileName, (*Iteration_Now)++);
while (!GetNextFile(FileName))
InsertListItem (panel, TargetRing, -1, FileName, (*Iteration_Now)++);
break;
default: //folder
if (!GetFirstFile(Folder, 0, 0, 0, 0, 0, 1, FileName)) //has at least 1 folder
int Folder_No = 0;
int Folder_Max = 50; //max 50 folders
char Folder_List [50][260]; //name 260 max
strcpy (Folder_List [Folder_No++], FileName); //copy first element then ++
while ( (!GetNextFile(FileName)) && (Folder_No < Folder_Max) )
strcpy (Folder_List [Folder_No++], FileName); //copy all folder names
for (int i = 0; i < Folder_No; i++)
char modFolder [260];
//Fmt (modFolder, "%s<%s%s", FileName, " (DIR)");
//InsertListItem (panel, TargetRing, -1, modFolder, (*Iteration_Now)++);
//MakePathname (TargetFolder, Folder_List [i], Folder); //recycle
//Ring_Populate (panel, TargetRing, TargetFolder, 1, Iteration_Now, (*Iteration_Now) - 1);
Fmt (modFolder, "%s<%s%s", Folder_List [i], " (DIR)");
InsertListItem (panel, TargetRing, -1, modFolder, i);
break;
It works fine. However, the section that I commented out (modified from the sample code, which works) gives me stack overflow.
//Fmt (modFolder, "%s<%s%s", FileName, " (DIR)");
//InsertListItem (panel, TargetRing, -1, modFolder, (*Iteration_Now)++);
//MakePathname (TargetFolder, Folder_List [i], Folder); //recycle
//Ring_Populate (panel, TargetRing, TargetFolder, 1, Iteration_Now, (*Iteration_Now) - 1);
This is the original code:
char displayName[MAX_PATHNAME_LEN];
Fmt (displayName, "%s<%s%s", fileName, " (Directory)");
InsertListItem (panelHandle, PANEL_LISTBOX, -1, displayName, (*numItems)++);
MakePathname (dir, dirNamesSaved[i], searchPath);
GetFilesAndDirectories(searchPath, numItems, (*numItems)-1);
Question:
1. How do I get stack overflow? My code is essentially the same.
2. My modified code works fine retrieving the list of folders. I do not see the need to call the function recursively. Can anyone explain?Hello all,
I can't figurate how to list all the root directories
(C:/> , D:/>, E:/> etc.) in a system.
I know how to recursively check the content of a
directory and all its subdirectories when a
predefined path is defined. However what I' d like to
do is actually give the option to pick one of the
root directories to start the iteration. I have been
looking around but I can' really find anything
helpful.
If any of you has any idea on how to achieve the
above objective some clarification would be really
appreciated.
Thanks in advance for your help!How to installing the Javax.comm package -
Hi,
I would like to get, if it is possible, do searching in one determinate folder and get all the files with the same extension, For example, Give the *.pou and get all the files on one list of the files in this folder and sub-folders...
If it is possible i would like to see any example.
Thanks a lot, Fonsi.Hi Dennis,
I got your advise, I download the openG (i had problems, and downloading directly and install one to one).
Ok, i got but i have one problem, which i can't solve. I entry the promt to search and put the directory to save, later i push 'Do it' and it search the files, show the paths and number, then save in the folder and finally show the window , all ok!.
The problem is with the target path, when i want use the browse, it doesnt run properly. I want select one carpet, and it demands one file, i dont understand why??, i changed the options browse but it didnt work. Also i would like when i put one path if folder doesnt exist, directly create it and save the files, if exist copy it.
Thanks for all!. I attached the file in lv 7.1
Attachments:
buscar3.vi 50 KB
capture.GIF 48 KB -
How can i open the directory/folder and read all the files inside it in order and then close it? any example would be nice.
thanksIn the File I/O>>Advanced File Functions Palette is a function named "List directory". This function will give you two arrays. One contains the names of all subdirectories the other the names of all files. If you want to sort them by name use the array sort function. If you want to sort them by another attribute use the File/Directory Info function to get more data. Use a cluster which contains the attribut to sort and the original index of the name. Then sort this array.
Waldemar
Waldemar
Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions -
Selecting all the files in a directory
How would i select all the files in a directory, write the info of the files into a new file, and after the end of each file, make a New Line?
hi zymus,
check this code u will get the solution for ur problem..
import java.io.*;
public class files {
public static void main(String[] args) {
File f = new File("c://");// specify ur directory name here
String[] n = f.list();
System.out.println("ALL FILES.....");
if (n != null)
System.out.println("length = " + n.length);
for (int i = 0; i < n.length; i++) { System.out.println("i = " + n[i]); }
String[] n2 = f.list(new myJavaFileFilter());
System.out.println("ALL JAVA FILES.....");
if (n2 != null)
System.out.println("length = " + n2.length);
for (int i = 0; i < n2.length; i++)
System.out.println("the files are::::::::: " + n2);
class myJavaFileFilter implements FilenameFilter
public boolean accept(File dir, String name)
if (name.indexOf(".pdf") > 0)// give the file extension what u want
return true;
return false; -
How to print/list all the groups/users present in Weblogic using Java code
Hi,
Weblogic version : 11.1.1.5
How to print/list all the groups/users present in Weblogic using Java code
I want to make a remote connection to Weblogic server and print all the users/groups present in it.
I have gone through the below mentioned site, but I cannot use the same approach since most of the API' are deprecated for example "weblogic.management.MBeanHome;"
http://weblogic-wonders.com/weblogic/2010/11/10/list-users-and-groups-in-weblogic-using-jmx/
Thanks in advance,
Edited by: 984107 on 05-Feb-2013 05:26
Edited by: 984107 on 05-Feb-2013 22:59see this http://www.techpaste.com/2012/06/managing-user-groups-wlst-scripts-weblogic/
Hope this helps. -
File Adapter polls all the files from the directory when deployed again
Hi,
File Adapter polls all the files from the inbound directory irrespective of the timestamp when deployed again.
For ex. when the BPEL process with file adapter is deployed, it starts polling the directory based on the timestamp as and when the directory is written with the files. I did not opt for deleting the files after read by the File Adapter.
But, when BPEL process is modified and deployed again, this time, the file adapter picks up all the files in the inbound directory and doesn't consider the timestamp.
My guess is that it should not pick all the files but based on timestamp only.
I guess I can observe the same behavior if I bounce the Application Server also
Do I have an option to achieve this?
Thanks,
Sasi Bhushan.try this:
1- create a File object for the directory. (look at isDirectory() )
2- create a File[] that represents the files in that directory. (.listFiles())
3- if (file[x].isDirectory()) {recursive method call;}
4- else {
process file;
If you want more help--do some work on it, and come back with specific questions relating to specific lines in your code and specific error messages you've been receiving. -
when i go to the app store to update the one app that needs to be updated, the screen is blank. It used to list all the apps that need updating and have a button called update all. Now nothing. Just a blank screen. How can I fix this?
There's been a problem with this all day. Seems to be a server problem - wait a day and try again, or use itunes on the computer to update, that works.
Maybe you are looking for
-
How to delete all history in the history box
story
-
I thought I had deleted it in iweb and started a new, unrelated website but then I see they are both alive under the same .com except one has .com/ with a different bit at the end. I ideally would like to either edit part of it or delete it all toge
-
Problem with processor fan.
Hi, since a few days ago the processor fan is not starting when I turn on the laptop, it just starts when I open any windows user session, it used to work fine, suddenly changed and I don't know how to fix it, also when Is not in "High performance" m
-
Layer Thumbnail Size In Illustrator CS-6
This is probably an FAQ but for the life of me, I can't find it in your database(s). Simple: in my Layers tabs, how do I control the size of those thumbnails? By default those thumbnails are tiny and I want to make them larger. So in the enclosed
-
I want to synch my bookmarks to my Android phone, but nothing I've tried works. Gmarks doesn't work. Xmarks doesn't work, Firefox Snych doesn't work (I am NOT installing Mobile Firefox because it won't work with my phone). IS there any way I can uplo