JNLP FileSaveService and File Exists
In all the examples I've seen on saving a file with FileSaveService, if the file already exists it is overwritten. Does anyone know how to implement code that would ask the user something like "File exists. Overwrite?" With JNLP it seems there's no way to check to see if the file exists without user interaction.
Apparently, there is a confirmation dialog:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4761577
It says that it's been fixed.
Similar Messages
-
FileSaveService ignored the file name and file extensions
I am using the JNLP API to build a JWS application. When using the FileSaveService, I found it automaticlly ignored the file name and file extensions I passed to the 'FileSaveService.saveFileDialog()'.
My code is like the following:
String[] xtns = {"csv"};
FileContents fileContents = fileSaveService.saveFileDialog(
".", xtns, stream, "testFile"); Im running this application in JRE version 1.6.0_20-b02 in Windows XP.
Although in the JNLP API, it said the file name and file extension 'might be ignored by the JNLP client', I still wonder if anyone has a better solution for this?
Thanks very much :)Sean.Wang wrote:
..I still wonder if anyone has a better solution for this?Visit [http://pscode.org/jws/api.html#fs]. Click the link to the 'Launch File Service (sandboxed) demo'. Type some characters into the text area then activate the 'Save File' button. Do you get a file chooser that defaults to (.zzz) extension?
Then if yes, and that is a 'better solution' for you, then yes, I have one. The code of the demo. can be downloaded at a link just to the right of the launch link. -
How to check if a specific file exist and which exit code to use ?
Hi, First I'm not a scripting guy and I know almost nothing about VB scripting.
I have a deployment of 6 tasks and I want to make sure that step # 2 will not be process if it failed in step #1, and so on for the 6 task.
To do this, i have to run a vb script before installation or uninstalltion on each steps
I'm trying to use a script (not from me) that i have modified for pre-uninstallation of software and also post-installation of the software.
Pre-uninstallation: The script will look if the specified "exe" exist on the server and if so, than it will run the msiuninstall "application_name".
If the uninstallation is successful, the post-installation script will check if the "exe" file exist again on the server, and it shouldn't find it (because it was deleted from the uninstallation), than it will return an exit code of successful
to run the next process.
Here an example:
Step 1: Uninstall "Software#1" with msiuninstall Software#1.exe command
Step 2: Uninstall "Software#2" with msiuninstall Software#2.exe command
Step 3: Install "Software #3"with an .exe extension
Step 4: Re install "Software #2" with an .msi extension
Step 5: Re install "Software #1" with a .msi extension.
Step 6: Send email to confirm the deployment is successful
So i need to validate that step #2 will not process step #3 if it failled on # 2. It need to validate if the file exist before and after.
At the end, Step 6 should send an email to confirm that the 6 steps of the deployment was completed without errors.
Any idea how to do it ?
Many many thanks for all the help !
A desperate guy :)
This is what i have
'This script will look if an .exe file exist for a specific application.
'=============================================================================================
path = WScript.Arguments.Item(0)
set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(C:\Inetpub\wwwroot\Enterprise\EnterpriseWS\web.config) = true then
exitCode = 0
else
exitCode = 1
End If
Wscript.Quit exitCodeSince you are not a scripting guy here is a very good place to start:
http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
¯\_(ツ)_/¯ -
Dialog prompt and check if file exists, and use the result of dialog
I have this working script and I want to change the way it behaves.
I want a dialog to come up, Do you want to skip or replace existing files.
Then the result of the dialog to be used in the reast of the script.
I've added it in the script where I need to use it. in noce big letters, hopefully its not a big job.
Many thanks
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not start with "Sue" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "GEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "GEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "pulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
--taking the folder identify which process it must follow.
if brandName is equal to "BH" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H Folder Photoshop Process
--if thefile exists in the folder localBrandFolder_PSD then do the result of dialog.
--"Skip" the file and move on to next
--If "replace" continue the rest of the script.
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end repeat
--End BH
-- else if and the rest of the script.....
end repeat
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tellHi,
I think that's what you want.
I put the dialog in the beginning, so it does not appear to each folder, otherwise put it in the loop as it was originally.
property type_list : {"8BPS"}
property extension_list : {"psd"}
script o
property theseNames : {}
end script
-- empty log file
do shell script "echo 'Files not processed in Photoshop :' > ~/Desktop/LogPhotoshopError.txt"
set noError to true
--at the beginning of the script, ask whether to replace or skip existing files? to apply to all?
--use the result for the if file exists?
display dialog "Should I replace or skip exisiting files?" buttons {"Replace", "Skip (Faster)"} default button 2 with icon 1
set skipFiles to (button returned of the result) is "Skip (Faster)"
--Setup list of folders and process details of folders
set dtF to paragraphs of (do shell script "ls -F ~/Desktop | grep '/' | cut -d'/' -f1")
set tc to (count dtF)
repeat with i from 1 to tc
set folderName to item i of dtF --<: is the folder name, no need to use text item delimiters -->":"
if folderName does not start with "2_" and folderName does not start with "Hot" and folderName does not start with "Press" and folderName does not start with "Design" and folderName does not start with "Keywords" and folderName does not start with "Season" and folderName does not start with "Sue" and folderName does not start with "Design" then
set {oldTID, my text item delimiters} to {my text item delimiters, "_WK"}
set FolderEndName to last text item of folderName
set brandName to first text item of folderName
set my text item delimiters to "_PSD"
set weekNumber to first text item of FolderEndName
set my text item delimiters to oldTID
set theFolder to ("Hal 9000:Users:matthew:Desktop:" & folderName)
--set up names to destination folders and create locally based on brand name and week number
set this_local_folder to "Images:2012-2013"
set localWeekFolder to my getFolderPath("WK" & weekNumber, this_local_folder)
set localBrandFolder to my getFolderPath(brandName, localWeekFolder)
set localBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", localBrandFolder)
set localBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", localBrandFolder)
set localBrandFolder_PSD to my getFolderPath(brandName & "_WK" & weekNumber & "_PSD", localBrandFolder)
set this_Network_folder to "GEN:Brands:Zoom:Brand - Zoom:Upload Photos:2013:"
set networkWeekFolder to my getFolderPath("Week" & weekNumber, this_Network_folder)
set networkBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", networkWeekFolder)
set website_images to "GEN:Website_Images:"
--set up names to destination folders and create over Netwrok for FTP collection (based on a mounted drive)
set this_ftp_folder to "pulse:"
set ftpWeekFolder to my getFolderPath("Week" & weekNumber, this_ftp_folder)
set ftpBrandFolder to my getFolderPath(brandName, ftpWeekFolder)
set ftpBrandFolder_Low_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_LR", ftpBrandFolder)
set ftpBrandFolder_High_Res to my getFolderPath(brandName & "_WK" & weekNumber & "_HR", ftpBrandFolder)
--taking the folder identify which process it must follow.
if brandName is equal to "BH" then
try
tell application "Finder" to set o's theseNames to (name of files of alias theFolder whose file type is in the type_list or name extension is in the extension_list)
on error
set o's theseNames to {} -- no psd files or "8BPS"
end try
set numOfNames to (count o's theseNames)
repeat with j from 1 to numOfNames
set thefile to theFolder & ":" & (item j of o's theseNames)
-- B H Folder Photoshop Process
tell application "Finder" to set b to exists file (localBrandFolder_PSD & item j of o's theseNames)
if b and not skipFiles then -- file exists and "replace" (continue the rest of the script).
tell application "Adobe Photoshop CS5.1"
-- I remove the command activate, Photoshop stay in background
set ruler units of settings to pixel units
try
open (alias thefile) showing dialogs never
set origName to name of current document
set myOptions to {class:JPEG save options, quality:12}
set myPSDOptions to {class:Photoshop save options, embed color profile:true, save layers:true}
tell current document
--If the quick mask mode has been left on then delete the channel Quick Mask
if (quick mask mode) then delete channel ¬
"Quick Mask"
--If the Layer is incorrectly labeled with Original Layer it needs renaming to original Image
if (exists layer "Original Layer") then ¬
tell layer "Original Layer" to set name to "Original Image"
save in (localBrandFolder_PSD & origName) as Photoshop format with options myPSDOptions without copying
(delete layer "Original Image") flatten
resize image resolution 300 resample method none
--sharpen image
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
save in (localBrandFolder_High_Res & name) as JPEG with options myOptions without copying
--get file path, return path of the JPEG file, work with (without copying)
-- (with copying) : it return path of PSD file
set newFile to file path --( return path of type alias )
-- duplicate file using the Finder -->on duplicateFile(..)
my duplicateFile(newFile, {ftpBrandFolder_High_Res})
--Prepare for Low RES by resetting image history
set current history state to history state 3
flatten
resize image width 1348
resize image resolution 300 resample method none
filter current layer using unsharp mask with options {amount:80, radius:3.2, threshold:0}
--add save to lowResFolder with same options
save in (localBrandFolder_Low_Res & name) as JPEG with options myOptions without copying
set newFile to file path
set newFile2 to newFile as string -- for testing end of name
if newFile2 ends with "_2.jpg" or newFile2 ends with "_3.jpg" then -- exclude website_images
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res})
else
my duplicateFile(newFile, {networkBrandFolder_Low_Res, ftpBrandFolder_Low_Res, website_images})
end if
close saving no
end tell
on error
set noError to false
my myLogs(thefile) -- write path to log file in Desktop
try
close saving no --if exists, close current document
end try
end try
end tell
end if -- else "Skip" the file and move on to next
end repeat
--End BH
end if
end if
end repeat
if not noError then do shell script "/usr/bin/open ~/Desktop/LogPhotoshopError.txt'"
on myLogs(t)
try
do shell script "echo " & (quoted form of t) & ">> ~/Desktop/LogPhotoshopError.txt'"
end try
end myLogs
on duplicateFile(tFile, foldersPath) -- tFile is an alias, foldersPath is a list of folder
tell application "Finder" to repeat with folderPath in foldersPath
with timeout of 200 seconds -- adjust it, error if the copy is longer that 200 seconds
duplicate tFile to folder folderPath with replacing
end timeout
end repeat
end duplicateFile
on getFolderPath(tName, folderPath)
tell application "Finder" to tell folder folderPath
if not (exists folder tName) then
return (make new folder at it with properties {name:tName}) as string
else
return (folder tName) as string
end if
end tell
end getFolderPath
tell application "Finder"
open "Hal 9000:Users:matthew:Desktop:LogPhotoshopError.txt"
end tell -
How to add new row and update existing rows at a time form the upload file
hi
How to add new row and update existing rows at a time form the upload file
example:ztable(existing table)
bcent smh nsmh valid date
0001112465 7.4 26.06.2007
0001112466 7.5 26.06.2007
000111801 7.6 26.06.2007
1982 7.8 26.06.2007
Flat file structure
bcent nsmh valid date
0001112465 7.8 26.06.2007 ( update into above table in nsmh)
0001112466 7.9 26.06.2007 ( update into above table in nsmh)
000111801 7.6 26.06.2007 ( update into above table in nsmh
1985 11 26.06.2007 new row it should insert in table
thanks,
Sivagopal RHi,
First upload the file into an internal table. If you are using a file that is on application server. Use open dataset and close dataset.
Then :
Loop at it.
*insert or modify as per your requirement.
Endloop.
Regards,
Srilatha. -
I'm trying to clean my mailbox and when I click on delete or highlight and move to trash I get a message that says "operation could not be completed - file exists. Further, when I select a message or group of messages, one of them is copied (not deleted) to the trash folder. Can someone help me through this?
Thanks.It's a POP account. I decided to clean up my mailbox today after noticing the computer was real slow after USA Today started sending their daily top stories with new graphics. Also before I noticed the problem with mail deletion - two things happened. 1) I updated security sofware as prompted by Apple and 2) downloaded Mackeeper and went throught some preliminary scans but did not buy their package. Thanks forn nstaying with me.
-
Iam trying to load illustator in my PC i get following error while loading Application CD 2
Adobe Illustrator CS4
Error:
Error 1603. Error 1305.Error reading from file C:\Program Files\Adobe\Adobe Illustrator CS4\Support Files\Required\Fonts\AdobeSongStd-Light.otf. Verify that the file exists and that you can access it.
AdobeColorCommonSetRGB
Error:
Error 2.
My serial no. [Removed by moderator]Download a copy an installer for CS4 from the links on this page:
Other downloads -
We are going through with an upgrade/migration to SSRS 2012 and moving everything to a different domain. We have about 200 active subscriptions running, the reports are being delivered to a file share. What is the correct way, in bulk, to change
the OwnerId, the Path and the FileShare Username password credentials for these subscriptions? I see these values are being stored in Subscriptions > ExtensionSettings. I see that the file share path and Owner wouldn't be a problem to change,
but since I see the file share credentials are encrypted I would not be able change them directly in ExtensionSettings. Anyone know the proper way to change the Owner ID, Path and file share credentials for my existing subscriptions without having to
change each one of them manually in the report manager?
Note: Reporting Services Native upgrade from SSRS 2005 to SSRS 2012.
Thanks in advance.Hi Cygnus46,
Based on my understanding, you want to change the Owner ID, Path and file share credentials for all existing subscriptions.
In Reporting Services, the subscription information are stored in the Report Server database. In your scenario, you can go to report server database and run the query to list all the subscriptions, then modify the owner and fileshare paths in the subscriptions
table. For more information, please refer to this article: Tip: Change the Owner of SQL Reporting Services Subscription. If you want to change
the file share credentials for subscriptions, you can run the query provided by
wiperzeus from this similar thread:
Windows File Share Delivery/ SSRS 2008 R2.
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
AppleScript - Writing to non-existent directories, and non-existent files..
All,
AppleScript - Writing to non-existent directories, and non-existent files...
Creating directories several levels deep on the fly.
How do we write to a file that does not exist, buried deep down in a hierarchy of directories that don't exist either...
In trying to do this I explored two options. One used AppleScript, assisted by UNIX, which was simplicity itself, the other one used only AppleScript and was considerably more complex, and slower.
http://www.mac-specialist.com/r/asckdirs.html
Hope these are useful,
Best Regards,
Bill Hernandez
Plano, TexasSimplified code examples - lacking extensive error checking -
UNIX example 001:
set file_Name to "Sales Figures.txt" -- File to create.
set file_Path to "2006 Sales:Forecast:Fruits:Flordia:Oranges:Large" -- Folder to create.
set UNIXfilePath to (quoted form of (POSIX path of file_Path))
try
do shell script "mkdir -p " & UNIXfilePath -- Attempt to create a folde, and respective intermediary folder(s).
end try
try
do shell script "touch " & UNIXfilePath & "/" & file_Name -- Attempt to create a blank file.
end try
UNIX example 002:
set file_Name to "Sales Figures.txt" -- File to create.
set file_Path to "2006 Sales:Forecast:Fruits:Flordia:Oranges:Large" -- Folder to create.
try
do shell script "mkdir -p " & (quoted form of (POSIX path of file_Path)) -- Attempt to create a folde, and respective intermediary folder(s).
end try
-- Create a file, and enter some text.
set FREF to open for access file (file_Path & ":" & file_Name) with write permission
write "Beispieltext" to FREF
close access FREF
AppleScript example:
set file_Name to "Sales Figures.txt" -- File to create.
set file_Path to "2006 Sales:Forecast:Fruits:Flordia:Oranges:Large" -- Folder to create.
-- Obtain list of text items of 'file_Path'.
set {oAStID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
set filePathList to text items of file_Path
set AppleScript's text item delimiters to oAStID
tell application "Finder"
set folder_Path to name of startup disk -- Obtain name of boot disk.
repeat with i in filePathList -- Cycle through list.
try
make new folder at folder_Path with properties {name:i} -- create folder.
set folder_Path to folder_Path & ":" & i -- Create new path for next new folder.
end try
end repeat
end tell
-- Create a file, and enter some text.
set FREF to open for access file (folder_Path & ":" & file_Name) with write permission
write "Beispieltext" to FREF
close access FREF
Mac OS X (10.4.4) -
File.exists() and accent on unix
Hi,
I made a main which test if a file exists.
I created files "toto" and "tété" on windows.
On windows the two files are seen.
I transfered them on a redhat.
The file "toto" is seen but "tété" is not.
Here is the code :
public static void main(String[] args) {
String filename = "/home/user/test/" + args[0];
System.out.println(new File(filename).exists());
}I tried to put the name of the file but it was not seen.
public static void main(String[] args) {
String filename = "/home/user/test/tété";
System.out.println(new File(filename).exists());
}If someone could help me it would be great.
Thanks.can you try
public static void main(String[] args) {
File file = new File("/home/user/test/");
File [] files = file.listFiles();
for(File f : files){
System.out.println(f.getName());
}if this displays the both file name, then problem with your locale setting of RedHat -
Applet checking if file exist and if no copy this file
Halo, everyone,
I'm new to java and I need an applet which is able to check if certain file exist on user's hard drive and if not to copy it.
I read that this is possible in certain circumstances, that applet has to be trustes and so on, but that's not my problem. My request is the applet code that checks of existance of certain file.
I'll lbe very thankful if someone could give me such applet or point me to place where I can see steps to creare it myself.
Thank you in advace onse again.Thnaks a lot for your answers. I really ppreciate!
How could I make the applet using such permissions i
how than it would work?I don't understand, in your first post you said "I read that this is possible in certain circumstances, that applet has to be trustes and so on, but that's not my problem. ". I assumed from this that someone else was dealing with the security aspects.
A starting point to signing Applets is - http://java.sun.com/developer/technicalArticles/Security/Signed/ but Google willl find you a whole load of information. -
System.IO.File.Exists And set IIS
Hi all.
I want Check file exists in SharePoint webpart.
So I found class the System.IO.File.Exists.
---source---
string path = @"\\nar-cla500s3\memo\test\skill\print-001.xls"; <-- return only false
try
if (System.IO.File.Exists(path))
Label.Text = "true";
else
Label.Text = "false";
catch { }
----source-----
If i wirte LocalPath(@"C:\memo\test\skill\print-001.xls), I Can get True.
My all APP's processID is win\lx13040020, And win\lx13040020 can access <\\nar-cla500s3\memo\test\skill\print-001.xls>
But I got only false...
is this double hope problem? I want check exists from file server.
I need your help, Thank you.Hi,
I will not recommend to change the settings from IIS. This fixes your problem but might create more. Setting the value to 'disable' means impersonation not in action and all resources will be accessed using app pool account instead of currently logged in
user. If you would run your code inside SPSecurity.RunWithElevatedPrivil... then you could bypass the impersonation without changing IIS settings. Now disabling the impersonation you add the risk of security breach as all users can access what app pool can
access. For SharePoint site, I don't think you should change settings from IIS.
Some useful links:
http://stackoverflow.com/questions/1061857/sharepoint-and-identity-impersonate-false
http://extreme-sharepoint.com/2012/05/30/impersonation-elevation-of-privileges/
Thanks,
Sohel Rana
http://ranaictiu-technicalblog.blogspot.com -
Utl_file.open_file question to check if a file exists and is not empty
Hello,
I am trying to write a code where in 3 seperate files are created based on some parameter condition for the extract call.
Say the parameters are NULL, 'A' and 'B'.
When Null condition is passed to the extract call then it should create file A and B if records are found. If not it should create empty files.
It is possible that the parameter to the extract is just 'A' then it would create A with say non zero file and B with zero file.
Now when the extract is called with 'B' parameter and if the file A already exists and is not empty then I should not touch/overwrite it with empty records.
Is there any simple way that I can do this to check if a file exists and is non empty?
I am using
open_file
( gv_utl_file_path
,lv_file_name
,lv_file_handle
Please help.
Thanks@OP : No Need to open
SQL> declare
2 lb_file_exist boolean;
3 ln_size number;
4 ln_block_size number;
5 begin
6 sys.utl_file.fgetattr('TEST_DIR','a.txt',lb_file_exist,ln_size,ln_block_size);
7 if lb_file_exist then
8 dbms_output.put_line('a Exists');
9 dbms_output.put_line(to_char(ln_size));
10 else
11 dbms_output.put_line('a Not Exists');
12 end if;
13 sys.utl_file.fgetattr('TEST_DIR','b.txt',lb_file_exist,ln_size,ln_block_size);
14 if lb_file_exist then
15 dbms_output.put_line('b Exists');
16 dbms_output.put_line(to_char(ln_size));
17 else
18 dbms_output.put_line('b Not Exists');
19 end if;
20 sys.utl_file.fgetattr('TEST_DIR','c.txt',lb_file_exist,ln_size,ln_block_size);
21 if lb_file_exist then
22 dbms_output.put_line('c Exists');
23 dbms_output.put_line(to_char(ln_size));
24 else
25 dbms_output.put_line('c Not Exists');
26 end if;
27 end;
28 /
a Exists
0
b Exists
3
c Not Exists
PL/SQL procedure successfully completed.Edited by: jeneesh on Mar 30, 2012 1:21 AM -
Getting FileNotFoundException, but the file exists and is read/write
So I'm trying to input a file and i get this exception, but the file does exist and the directory is correct.
import java.util.Scanner;
import java.io.File;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
public class Assignment1 {
public static void main(String[] args){
File file = new File("C://Users//The RTV//Documents//Procject1//src//test.txt");
if(file.exists()){
System.out.println("*");
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
}when I remove the BufferedInputStream in = new BufferedInputStream(new FileInputStream(file)); The star prints, so the file does exist, but I keep getting that exception when I put the code back. I also get that exception when I remove the File file and the if statement and just have the buffered input. Can anyone explain to me why this is happeneing?Procject1Typo?Less likely if file.exists() passes.
what about "file.canRead()"? You should also try this, could be a permissions problem.My best guess, despite the thread title. From the Javadoc for FileInputStream(File) :
Throws:
FileNotFoundException - if the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading.
That last part seems kind of misleading.
Edit:
By the way are you logged on as "The RTV" when you test this?
Edited by: endasil on 10-Sep-2009 4:53 PM -
OK, i create a directory i have read/write permissions on the directory, but still even if the file exists its bringing back the result as if it doesnt i need help with this...
set serveroutput on
DECLARE
fexists BOOLEAN;
flen NUMBER;
bsize NUMBER;
BEGIN
sys.utl_file.fgetattr('TMP_LOCATION', 'test.txt', fexists, flen, bsize);
IF fexists THEN
dbms_output.put_line('File Exists');
ELSE
dbms_output.put_line('File Does Not Exist');
END IF;
dbms_output.put_line('File Length: ' || TO_CHAR(flen));
dbms_output.put_line('Block Size: ' || TO_CHAR(bsize));
END fgetattr;
File Does Not Existmy directory.. CREATE or replace DIRECTORY tmp_location AS 'Server-1\configsheets\completed\pdf approved'Good afternoon,
If you are loooking at a mapped drive, you can only see it if you change how the Oracle services start. You need to have them start with a specific user ID rather than starting as system services. The problem is that the system services cannot see mapped drives.
So, do this:
<li>Create a user to be used by Oracle services. Make sure they have the correct rights (I gave mine Server ADMIN so as to have all the access I needed)
<li>Log into the server and modify the services
<li>Click the 'Log On' tab and enter the account and password you created for the Oracle Processes
<li>Reboot the server, allowing the Oracle services to log in with this new ID.
This should then fix your problem.
Thanks,
Don.
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone! :)
Maybe you are looking for
-
i need safari on my ipod i had it now it is gone and it is really annoying i cannot download some apps all because of an ios thing i would appreciate it if i could get ios 7 so someone please help me
-
I cannot log into either Disqus or (it seems) Livefyre. When I attempted to submit a report to Disqus, I get a 403 error code. In Livefyre, when I make comments, they appear on my screen, but apparently not on anyone elses (repeated requests for a pi
-
Hi, We have developed an Invoice in SmartForm which will display data in English and Thai Language. We have seperate Paragraph and Character Formats for them defined in one SmartStyle. Now depending on the language some free text are maintained we ha
-
Router "ignores" iMac network traffic after a short while...
someone here might be able to help. Here are my symptoms: My home network consists of Comcast broadband connected to an SMC 802.11N broadband router, which then feeds into several switches and several other wireless access points in my house to supp
-
Need help in dbms_output package
Hi, I am using dbms_output package in my sql, while displaying the content its not coming in one line. Could you please help me out here. DBMS_OUTPUT.PUT_LINE ('Its testing for around '||l_run_time||' minutes in this step, but average test time for t