Use thread to check for file exists. How?
public class FileSearcher extends Thread
String name = "Unknown";
//RunFileSearcher rfs = new RunFileSearcher(name);
//FileSearcher rfs = new FileSearcher(name);
File f = new File();
Thread t = new Thread(); // create the thread
t.start(); // start the thread running
public void run(name)
if( f.exists(name) )
System.out.println("*** File " + f + " has been created. ***");
else
System.out.println("Searching for file " + f) ;
}How do I use each thread to check for each file exists per sec??
Please Help Thanks
1) Why are you using Threads?
2) It is preferrable to implement Runnable.
3) This is all incredibly pointless (see point 1)
Similar Messages
-
Java script in HTMLDB to check if file exists in Unix file system
How do I use javascript to check if file is exists in Unix file system. I would like to dispaly the columns only if file is exists.
Hello,
This is one of those features that the manuals do not cover.
How to use and build AJAX features could be a whole book all by itself, and it's not really HTML DB specific feature even though we have built some hooks in application and javascript to make it easier.
Take a look at this thread
Netflix: Nice UI ideas
and I've built some examples here
http://htmldb.oracle.com/pls/otn/f?p=11933:11
Or just search the forums for AJAX or XMLHTTP
Carl -
Checking for files in a folder -- Wrong output
Hi guys,
I'm writing a simple program, I have to check for 6 files (hardcoded, they will never change) if they are in certain directories/paths.
The problem is, I think I have a problem in my IF statements, because it continueally returns false.
The paths are on networked drives, does that make a difference?
I'm rather stuck on this one, any help would be appreaciated.
(some paths/file names have been replaced by "xxxxxxxxx", for security)
* Checks for files in a directory, prints results.
* @author Mitchell
* @version 0.2
* @date 28 Jul '05
import java.awt.*;
import java.io.*;
import java.lang.Object;
import javax.swing.*;
import java.util.*;
public class FileCheck extends JFrame
//declare filenames/paths, add more if needed.
String fileName1 = "file it2_load.txt";
String fileName2 = "mo_batch.txt";
String fileName3 = "mo_bcp.txt";
String fileName4 = "mo_load.txt";
String fileNameX = "IT2_1000_yyyymmdd.txt";
String fileNameY = "IT2_2000_yyyymmdd.txt";
//declare directories to search
String fileLocation1 = "\\\\xxxxxxxxx\\aus_bear\\Patrol";
String fileLocation2 = "\\\\xxxxxxxxx\\nz_bear\\Patrol";
String fileLocation3 = "\\\\xxxxxxxxx\\bear\\remote\\RTS";
String fileLocation4 = "\\\\xxxxxxxxx\\bear\\remote\\RTS";
//declares array for filename storage. Change if needed.
File fileNamesArray1[];
File fileNamesArray2[];
File fileNamesArray3[];
File fileNamesArray4[];
//set path to find files
File filePath1 = new File(fileLocation1);
File filePath2 = new File(fileLocation2);
File filePath3 = new File(fileLocation2);
File filePath4 = new File(fileLocation2);
//string buffer to store results
StringBuffer results = new StringBuffer();
//start of FileCheck method
public FileCheck()
//collects all filenames from pre-set path1
fileNamesArray1 = filePath1.listFiles();
results.append("This program checks for files in given folders."
+"\nTRUE = File does exist in folder."
+"\nFALSE = File does not exist in folder.\n\n");
results.append(fileLocation1 + "\n");
//start for loop1 - check for pre-set filenames in path1
for(int i=0; i < fileNamesArray1.length; i++)
if( fileName1.equals(fileNamesArray1.toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else if( fileName2.equals(fileNamesArray1[i].toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else if( fileName3.equals(fileNamesArray1[i].toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else if( fileName4.equals(fileNamesArray1[i].toString()))
results.append("PATH1 >> " + fileNamesArray1[i] + " >> TRUE\n" + fileNamesArray1[i].lastModified());
else
results.append("PATH1 >> " + fileNamesArray1[i] + " >> FALSE\n");
} //end for loop1
//collects all filenames from pre-set path2
fileNamesArray2 = filePath2.listFiles();
results.append("\n" + fileLocation2 + "\n");
//start for loop2 - check for pre-set filenames in path2
for(int j=0; j < fileNamesArray2.length; j++)
if( fileName2.equals(fileNamesArray2[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else if( fileName2.equals(fileNamesArray2[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else if( fileName3.equals(fileNamesArray1[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else if( fileName4.equals(fileNamesArray1[j].toString()))
results.append("PATH2 >> " + fileNamesArray2[j] + " >> TRUE\n" + fileNamesArray2[j].lastModified());
else
results.append("PATH2 >> " + fileNamesArray2[j] + " >> FALSE\n");
} //end for loop2
//collects all filenames from pre-set path1
fileNamesArray3 = filePath3.listFiles();
results.append("\n" + fileLocation3 + "\n");
//start for loop3 - check for pre-set filenames in path1
for(int k=0; k < fileNamesArray3.length; k++)
if( fileNameX.equals(fileNamesArray3[k].toString()))
results.append("PATH3 >> " + fileNamesArray3[k] + " >> TRUE\n" + fileNamesArray3[k].lastModified());
else
results.append("PATH3 >> " + fileNamesArray3[k] + " >> FALSE\n");
} //end for loop3
//collects all filenames from pre-set path4
fileNamesArray4 = filePath3.listFiles();
results.append("\n" + fileLocation4 + "\n");
//start for loop4 - check for pre-set filenames in path1
for(int l=0; l < fileNamesArray4.length; l++)
if( fileNameY.equals(fileNamesArray4[l].toString()))
results.append("PATH4 >> " + fileNamesArray4[l] + " >> TRUE\n" + fileNamesArray4[l].lastModified());
else
results.append("PATH4 >> " + fileNamesArray4[l] + " >> FALSE\n");
} //end for loop4
//construct displaybox for results
JTextArea textArea = new JTextArea( results.toString() );
textArea.setEditable(false); //disables modification of results
Container container = getContentPane();
container.add( new JScrollPane( textArea ) );
setSize( 500, 500 ); // set window size
setVisible( true ); //allow visibility
//main
public static void main (String args[])
FileCheck window = new FileCheck();You could try using the File.exists() method.
The paths are on networked drives, does that make a difference?Try the above on a local file and a networked file.
I'm writing a simple program, Actually a simple program would be something like:
File file = new File("xxx");
System.out.println(file.exists());No need to include all the code you posted.
http://www.physci.org/codes/sscce.jsp -
I'm a DBA working with 3 application developers, they want to know how to check for index existing for certain column
in a table in their schema,
one friend told me , to check for index existing for certain column you have to query
the view dba_ind_columns so you have to be a sysdba user
but I don't want to grant the application developers the sysdba privilage
but my friend told me , to avoid grant sysdba to the application developers, they can query the view user_indexes in their schema, but after watching the view user_indexes ,
it gives me a lot of data but doesn't give me the COLUMN NAME
how can I solve this problem which is :
Allow the application developers to check for index existing for certain column in their schema without granting them sysdba privilage.You can use that query:
select ai.index_name INDEX_NAME,
substr(ic.column_name, 1, 30) COLUMN, ic.column_position POSITION,
ic.table_name TABLE,
ai.tablespace_name TABLESPACE
from all_ind_columns ic, all_indexes ai
where ai.index_name = ic.index_name and ai.table_name = 'TABLE_NAME' and ai.table_owner='OWNER' -
[solved] "pacman -Syu" hangs after "checking for file conflicts"
This is my third attempt. I let it run yesterday for 20 hours on the theory that maybe it was actually doing something. It always completes "checking for file conflicts" but never goes any further.
Does anyone have any suggestions how to get it to continue?
[ken@xxxxx ~]$ sudo pacman -Syu
:: Synchronizing package databases...
core is up to date
extra 1421.6 KiB 2.03M/s 00:01 [######################] 100%
community 1775.0 KiB 3.00M/s 00:01 [######################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...
Targets (27): binutils-2.23-1 coreutils-8.20-1 cryptsetup-1.5.1-1
device-mapper-2.02.98-1 emacs-24.2-2 filesystem-2012.10-2
firefox-16.0.2-1 gcc-4.7.2-2 gcc-libs-4.7.2-2 glibc-2.16.0-5
hwids-20121022-1 imagemagick-6.8.0.3-1 libidn-1.25-1
libwbclient-3.6.9-1 linux-api-headers-3.6.3-1 lvm2-2.02.98-1
mkinitcpio-0.11.0-1 nspr-4.9.3-1 nss-3.14-1
nss-myhostname-0.3-3 smbclient-3.6.9-1 systemd-195-2
thunderbird-16.0.2-1 tzdata-2012h-1 util-linux-2.22.1-2
wget-1.14-2 xulrunner-16.0.2-1
Total Download Size: 47.80 MiB
Total Installed Size: 550.57 MiB
Net Upgrade Size: 6.43 MiB
Proceed with installation? [Y/n] y
:: Retrieving packages from extra...
libwbclient-3.6.9-1... 19.5 KiB 407K/s 00:00 [######################] 100%
smbclient-3.6.9-1-x... 7.9 MiB 2.71M/s 00:03 [######################] 100%
thunderbird-16.0.2-... 17.1 MiB 2.92M/s 00:06 [######################] 100%
xulrunner-16.0.2-1-... 22.9 MiB 2.92M/s 00:08 [######################] 100%
(27/27) checking package integrity [######################] 100%
(27/27) loading package files [######################] 100%
(27/27) checking for file conflicts [######################] 100%
Last edited by KenJackson (2012-10-30 14:25:05)Allan wrote:Can you run with --debug?
OK. That garnered an additional piece of info. Here's the end of the long output:
debug: searching for filesystem conflicts: wget
debug: searching for file conflicts: xulrunner
debug: searching for filesystem conflicts: xulrunner
checking available disk space...
debug: checking available disk space
Disk space? I think I have enough disk space.
[ken@xxxxx ~]$ df
Filesystem Size Used Avail Use% Mounted on
rootfs 47G 11G 34G 25% /
dev 2.0G 0 2.0G 0% /dev
run 2.0G 292K 2.0G 1% /run
/dev/sda3 47G 11G 34G 25% /
shm 2.0G 140K 2.0G 1% /dev/shm
/dev/sda1 99M 21M 74M 22% /boot
/dev/sda4 72G 1.9G 66G 3% /home
Is disk space really the problem? Or is that just where it hung? -
I used someones Apple id for my phone, how do i turn the the feature off that allows them to read my me messages
Is you Gmail address set up in your iCloud account as the primary? Then nothing to do.
If not, you can set it up that way, here: https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
Or just configure iCloud on your phone or your Mac.
On the Mac, iCloud System Prefs, sign in and check the Mail checkbox. -
Pacman hanging on "checking for file conflicts"
I've tried running pacman -Syu on my laptop and pacman is simply hanging at the checking for file conflicts stage. I've let it sit for several minutes, but it never seems to get past that stage. The list of packages to be updated isn't long:
Targets (5): bison-2.6.2-1 chromium-21.0.1180.75-1 flex-2.5.37-1 libldap-2.4.32-1 lm_sensors-3.3.2-4
This is being done on a laptop that was only recently rebuilt with a new Arch install using the latest installation media. The install went well and previous updates have worked with no problems.I'm glad you solved the problem but "pacman -Scc" shouldn't be necessary and makes it more difficult to recover in a variety of situations. You can always re-download old packages but having them in your cache makes it easy to roll something back and makes it possible to do this without, for example, a working network connection. I installed in November and I've never even run "pacman -Sc" let alone "pacman -Scc". (Though I have trimmed the cache to free up disk space using, I think, paccache.)
-
Checking for file conflicts: could not get filesystem information
When I try to install a new package with pacman 4 I got the following warning just after pacman has done "checking for file conflicts":
warning: could not get filesystem information for /var/lib/ntp/etc/resolv.conf (deleted): No such file or directory
After the warning message is printed, the installation continues normally. This warning message has never shown up before.
I have ntpd running in a chroot as a non-root user (instructions).
I am wondering if anyone else gets the same warning message and if this 'problem' can be solved.
I forgot to say: the file is still there according to ls and is not empty, but the contents differs form the /etc/resolv.conf-file.
tim@tim-notebook:~$ cat /var/lib/ntp/etc/resolv.conf && echo && cat /etc/resolv.conf
# Generated by NetworkManager
# Generated by NetworkManager
nameserver 192.168.1.1
Last edited by timothy (2012-01-19 00:15:51)I'm not sure how to do that or I do not know exactly what you mean.
tim@tim-notebook:~$ pkgfile -gs "*etc/resolv.conf"
core/filesystem
extra/archboot
But you probably already knew that.
Running pacman with the --debug option did not gave me any more clues. All I know now, is that this message is printed when the moundpoints are examined:
stderr 'pacman -Syu--debug' output wrote:(...)
debug: checking possible conflict: /var/lib/
debug: file is a directory, not a conflict
debug: checking available disk space
warning: could not get filesystem information for /var/lib/ntp/etc/resolv.conf (deleted): No such file or directory
debug: mountpoint: /var/lib/ntp/proc
debug: mountpoint: /var/lib/ntp/lib
debug: mountpoint: /var/lib/ntp/etc/services
debug: mountpoint: /tmp -
[solved] pacman 4 hangs after "checking for file conflicts"
Like others, I removed yaourt and package-query because they conflicted with pacman4... not worried about that, I'll reinstall them later.
I put the new pacman.conf in place (my old one wasn't really customized). I left SigLevel = Never.
Now, I can run pacman -Sy fine, but if I try to install anything, I it just hangs:
sudo pacman -S audacity
resolving dependencies...
looking for inter-conflicts...
Targets (1): audacity-1.3.14-2
Total Download Size: 3.21 MiB
Total Installed Size: 15.29 MiB
Net Upgrade Size: -0.00 MiB
Proceed with installation? [Y/n]
:: Retrieving packages from extra...
audacity-1.3.14-2-x86_64 3.2 MiB 1397K/s 00:02 [###########################] 100%
(1/1) checking package integrity [###########################] 100%
(1/1) loading package files [###########################] 100%
(1/1) checking for file conflicts [###########################] 100%
I've waited up to 20 or 30 minutes and nothing happens. It's not just audacity, any package I try to install does this.
Suggestions?
Last edited by TheAmigo (2012-01-17 18:55:38)With --debug switch it prints:
checking for file conflicts...
debug: looking for file conflicts
debug: searching for file conflicts: coreutils
debug: searching for filesystem conflicts: coreutils
debug: searching for file conflicts: ethtool
debug: searching for filesystem conflicts: ethtool
debug: searching for file conflicts: fail2ban
debug: searching for filesystem conflicts: fail2ban
debug: searching for file conflicts: gpgme
debug: searching for filesystem conflicts: gpgme
debug: searching for file conflicts: vim-runtime
debug: searching for filesystem conflicts: vim-runtime
debug: searching for file conflicts: gvim
debug: searching for filesystem conflicts: gvim
debug: searching for file conflicts: hdparm
debug: searching for filesystem conflicts: hdparm
debug: searching for file conflicts: inetutils
debug: searching for filesystem conflicts: inetutils
debug: searching for file conflicts: lib32-glibc
debug: searching for filesystem conflicts: lib32-glibc
debug: searching for file conflicts: lib32-gcc-libs
debug: searching for filesystem conflicts: lib32-gcc-libs
debug: searching for file conflicts: lib32-glib2
debug: searching for filesystem conflicts: lib32-glib2
debug: searching for file conflicts: lib32-gdk-pixbuf2
debug: searching for filesystem conflicts: lib32-gdk-pixbuf2
debug: searching for file conflicts: lib32-pango
debug: searching for filesystem conflicts: lib32-pango
debug: searching for file conflicts: lib32-gtk2
debug: searching for filesystem conflicts: lib32-gtk2
debug: searching for file conflicts: linux
debug: searching for filesystem conflicts: linux
debug: searching for file conflicts: nspluginwrapper
debug: searching for filesystem conflicts: nspluginwrapper
debug: searching for file conflicts: nvidia
debug: searching for filesystem conflicts: nvidia
debug: searching for file conflicts: qtwebkit
debug: searching for filesystem conflicts: qtwebkit
debug: searching for file conflicts: rpcbind
debug: searching for filesystem conflicts: rpcbind
debug: searching for file conflicts: unrar
debug: searching for filesystem conflicts: unrar
debug: searching for file conflicts: xscreensaver
debug: searching for filesystem conflicts: xscreensaver
checking available disk space...
debug: checking available disk space
Without the --debug switch
Proceed with installation? [Y/n]
(21/21) checking package integrity [############################] 100%
(21/21) loading package files [############################] 100%
(21/21) checking for file conflicts [############################] 100%
Note that the 'checking available disk space...' is not printed without the --debug option although it doesn't look like being 'debug output'.
I don't see much disk activity after that and the pacman process uses no CPU time and the process status goes to D in `ps` (man ps says: D: Uninterruptible sleep (usually IO)).
Last edited by drrossum (2012-01-18 21:58:28) -
The entire family has used one itunes account for years. How do we all set up separate iCloud accounts now? Or should we? 5 macbooks, 2 ipads, 4 iphones, 2 itouch, 2 imacs. How does one decide what to sync, share and what not to? Green Jeans.
You need to start by understanding the distinction between iTunes and iCloud - Apple confuse the issue by referring to 'iTunes Match' as part of iCloud. It isn't.
You don't have to have the same login (Apple ID) for iTunes and iCloud; many people don't and there's no problem about it.
Your iCloud ID gets you email, calendars, contacts, iWork documents and PhotoStream syncing between devices.
Your iTunes ID gets you the iTunes Store, the App Store for iOS, the Mac App Store for OSX,, 'iTunes in the Cloud' (downloading of purchased items to any logged-in device) and 'iTunes Match' (uploading of songs not purchased in the iTunes Store).
Your family members can easily each get their own iCloud account to keep email etc. separate - in each case they will need a different non-Apple email address (a free one from Yahoo etc. would do) to set up the ID. If they are sharing a Mac they need to be using a separate user account.
They can have their own iCloud accounts and still all sign into the same iTunes account: or they can open their own iTunes accounts using their new iCloud Apple IDs.
BUT they cannot transfer items purchased under the present iTunes ID to different iTunes IDs. -
My mobile me expired and I want to use the same username for icloud. How?
My mobile me expired and I want to use the same username for icloud. How?
When I registered for me.com, they kept saying the my username is already taken which is true since I registered for [email protected] previously and the subscription has expired.
How can I get apple to delete my mobile me account completely?http://howto.cnet.com/8301-11310_39-20119371-285/how-to-transfer-your-mobileme-a ccount-to-icloud/
and
http://www.apple.com/mobileme/transition.html
should assist you in questions -
HT204053 Hello I found someone using My Apple ID for face time how can I disable it
Hello I found someone using My Apple ID for face time how can I disable it
Welcome to the Apple community.
Change your password.. -
How to Check Images File Exist? in different server
Hi,
I have 10 different coldfusion server.
for example 9 server is for the web application site - for
example
http://myserverone/studentweb
the other one is for images website, just for displaying
student picture - for example
http://myserverimage/studentpicture.
the purpose of this website is to display student picture
that i store as gif files.
from my studentweb website i will call the images from
studentpicture website as source for my image placeholder.
for example this is my code i'm calling form
http://myserverone/studentweb
website:
<img src="
http://myserverimage/studentpicture/#studentnumber#.gif"
alt="" name="studentpicture" width="160" height="200">
my problem is, if there is no specific student picture in my
studentpicture website, then the placeholder will display an X (
mean the images not found )
how do i prevent the X to display?
how do i using coldfusion or any kind of way to check if the
images exist on that website ( different server ), so if the images
is not found, i can display a default images? i can do this if i'm
calling the website in the same server, but not using a different
server.
this is like using other website images for your own personal
website and sometimes the owner delete the images from their
website, and i want to display my own images if that images been
removed from the source website.
anyone have done this before?
thanks for suggestion and guide...
haire1. Use CFHTTP with method="HEAD".
2. See, if the HTTP status code is 200.
The head-method is of course more efficient, as it doesn't
need to "get" the message body. However, a status code of 200 is
possible even when the requested image file is no longer on the
server. -
Checking for files using infoview
Hi
I am new to use Infoview in BO. In my project they are scheduling CR in infoview for a particular time. now new requirement is :
On nightly basis files will be send for each region.once they are loaded message will be generated using script in unix. Now my part is to login to the unix server and check for the message(access to the path will be provided. message may be content in file or may be a touch file.not my part) and the schedule timing through infoview and should run the report.
To schedule report for a particular time i went into schedule option and given database details where CR is present,destination details to where it need to be ftped and the format of output and timine on which the report need to be run.
But i dont know the process how to login to unix server and check for message.
Please let me know is there any option for the baove requirement in infoview.
Thanks in advance.CMC is the administration console. I would recommend to take a look at the following document:
http://help.sap.com/businessobject/product_guides/boexir2/en/xir2_bip_Admin_en.pdf
Start at page 200.
Regards,
Stratos -
How to check whether file exist in a folder at the application server
Hi to all experts.
if suppose there is a file at the application server test.txt my requirement if the one more file is created of the same name before overwriting the file a warning message is to displayed to the user that the file already exist .
how to do itHI Mohammed,
use The FM DX_FILE_EXISTENCE_CHECK
or static class CL_GUI_FRONTEND_SERVICES=>FILE_EXIST
For more info
search file in application server
application server
hope it helps you.
Regards!
Maybe you are looking for
-
WhatSize this: mid-2009 MBP w/LION has full HD
i am starting to use Mac OS with enough fluency to try to solve some long ongoing issues with my Mid-2009 MBP. right now the issue is that i have a 250 GB HD and i cannot store /any/ documents on this computer because the hard drive is filled up with
-
My iPhone could not be activated because the activation server is temporarly unavailable?
my iPhone could not be activated because the activation server is temporarly unavailable. what should i do?
-
Place a subform at the bottom of Last page
Dear all, I want a subform to come at the extreme bottom of the last page.Suppose in last page fields are upto middle of the page but the required subform should only come at extreme bottom of the page not to adjacent to the end of the fields.How can
-
Service GR link with Production Order confirmation
Dear PP Experts, My scenario is like this , With respect to service one annual contract will be there & one release Purchase Order for one month will be there. I want to take this service with Service GR from Service Entry sheet in a particular opera
-
I have problem with my bluetooth
Every time I turn on my bluetooth it ask me to pair the Bluetooth