Create directory with FileOutputStream
I'm on a directory dir1.
I write
out = new FileOutputStream(./dir2/doc.html);
and when I execute I have :
./dir2/doc.html : no such file or directory
of course this directory doesn't exist.
Is it possible that the constructor create the directory ?
Or must I do anything else ?
What can I do ?
Thanks
Welcome to the world of computing......
What you need to do is check for exception like the one you mention and take appropriate step(s) to remedy the situation -- in this case make the directory with something like:
boolean x=new File(path).mkdir();
V.V.
Similar Messages
-
Cocoa creating directory with "/"
hello,
this might seem a bit strange but in finder if you make a new folder you can include a "/" in the folder name:
this/is/my/new/folder //name of folder created by finder
using createDirectoryAtPath how could you do this since the "/" in the folder name will be confused with making a directory? example:
createDirectoryAtPath:@"/Users/Username/Desktop/this/is/my/new/folder"
it won't work right? maybe there is a way to put an escape clause to make it work or another method? any help is appreciated.
rickMaybe you can find an answer here (how to replace "/" by a code) :
http://www.fileformat.info/info/unicode/char/2215/index.htm -
Create directory with system date for export files
Hello,
I have a requirement to add the system date folder automatically, as the exports files dumps get into to d:\oracle\exp\..... this should be d:\oracle\exp\03182009. for each day it should create these date folder to dump the export files.
here I am sending two of my scirpts .
first one is
set ORACLE_SID=%1
set PATH=D:\ORACLE\ora102\bin;C:\WINNT\system32;C:\WINNT
set LOCAL=2:%1
net use h: /delete
net use login
sqlplus test/test@%1 @d:\oracle\dba\apps\expfull\buildfile < d:\oracle\dba\apps\expfull\enter.txt
exp parfile=h:\admin\%1\exp\%1_FULL.par
call h:\admin\%1\exp\%1_FULL.cmd
this is the buildfile script
set term on
set head off
set feed off
set ver off
set lines 159
set pages 0
set wrap on
set concat off
clear columns
clear computes
clear breaks
clear buffer
ttitle off
btitle off
col dbnm new_value sid_dir noprint
col parnm new_value parfil noprint
col dmpnm new_value dmpfil noprint
col lognm new_value logfil noprint
col lstnm new_value lstfil noprint
col zipnm new_value zipfil noprint
col cmdnm new_value cmdfil noprint
col ownr new_value ownername noprint
col tabnm new_value tabname noprint
col partnm new_value partname noprint
col datest new_value datestmp noprint
-- Load the sid_dir, ownername, tabname, partname, and datestmp substitution variables.
select
name dbnm
, to_char(sysdate,'YYYYMMDD')||'_'||'N' datest
, upper('&1') ownr
, upper('&2') tabnm
, upper('&3') partnm
from v$database;
-- Load the filename substitution variables.
select
'&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'.par' parnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'_'||'&datestmp'||'.dmp' dmpnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'_'||'&datestmp'||'.log' lognm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'_'||'&datestmp'||'.zip' zipnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'.lst' lstnm
, '&sid_dir'||'_'||'&ownername'||'_'||'&partname'||'.cmd' cmdnm
from dual;
-- Build the export parameter file.
spool h:\admin\&sid_dir\exp\&parfil
prompt userid=test/test@&sid_dir
prompt buffer=4194304
prompt direct=Y
prompt recordlength=65535
prompt consistent=Y
prompt file=h:\admin\&sid_dir\exp\&dmpfil
prompt log=h:\admin\&sid_dir\exp\&logfil
prompt tables=(&ownername.&tabname:&partname)
spool off
Please help out...>
I have a requirement to add the system date folder automatically, as the exports files
dumps get into to d:\oracle\exp\..... this should be d:\oracle\exp\03182009. for each
day it should create these date folder to dump the export files.OK - well, you will (AFAICR) have to create the directory, then cd into it,
then run your script - I don't see what the problem is?
You could* do something like -
at 00:01 run a cron job that simply does something like this
(I'm just giving outline - not a particular implementation)
runs date
gets the day, month and year from that -
export MyDay=day
export MyMonth=month
export MyYear=year
mkdir /path/to/dir/oracle/exp/$MyDay$MyMonth$MyYear
At the beginning of your script, before going into SQLPlus
----Your usual stuff------------
set ORACLE_SID=%1
set PATH=D:\ORACLE\ora102\bin;C:\WINNT\system32;C:\WINNT
set LOCAL=2:%1
net use h: /delete
net use login
++++plus
cd /path/to/dir/oracle/exp/$MyDay$MyMonth$MyYear
Maybe this will be a help to get you started - it could probably be much more elegant in
Python or whatever, but if shell-scripting is the way you want to go...
I'd be interested to see if this can provide the basis for a solution.
HTH and TIA.
Paul... -
Backup failed with Error: (-50) Creating Directory
Repeats ad nauseum.
This is backing up to a second internal drive that is an exact duplicate (in terms of HD model and size).
Does anyone know what Error -50 means? Lack of permissions? Invalid name (doesn't seem like it)?
8/30/08 9:06:37 AM /System/Library/CoreServices/backupd Starting standard backup
8/30/08 9:06:37 AM /System/Library/CoreServices/backupd Backing up to: /Volumes/Sliffy Time/Backups.backupdb
8/30/08 9:06:58 AM /System/Library/CoreServices/backupd Error: (-50) Creating directory 2008-08-30-090658.inProgress
8/30/08 9:06:58 AM /System/Library/CoreServices/backupd Failed to make snapshot container.
8/30/08 9:07:03 AM /System/Library/CoreServices/backupd Backup failed with error: 2Hi Glenn,
Thanks for the suggestion. Nope, it's not listed. The only thing listed is my Time Machine volume.
After a reboot, Time Machine seems to be working. It's making backups on schedule and the logs look good, not reporting any strangeness.
A bit bummed about these phantom errors that go away on reboot. I'll keep on eye on the error/reboot frequency.
Rob -
I try to create a directory on a mapped directory with forms 10g ?
Hello !
I try to create a directory on a mapped directory with forms 10g in web environment. The mapped directory is located on the application server. For this, I use this command : host('cmd /c md h:\test'); and it doesn't work.
When I execute this command directly on the server, it works good...
Thanks
Pascal Mottay
FranceHello !
I try to create a directory on a mapped directory with forms 10g in web environment. The mapped directory is located on the application server. For this, I use this command : host('cmd /c md h:\test'); and it doesn't work.
When I execute this command directly on the server, it works good...
Thanks
Pascal Mottay
France -
I have a use case where I need to use different download directories with different firefox profiles.I need to use this profiles in multiple linux machines.
I need to have a relative path to my download directory with respect to the profile folder.
Ex: I have a selenium test which opens a website and downloads it to my machine.I want this downloaded file to go into some specific folder relative to this profile folder.How do I do this??That is not a practically empty xinitrc - that file only needs one line: exec WM. Other things are entirely optional, and some of them very useful, but I'd encourage you to stick with the simplest xinitrc that will do what you require.
Is slim involved? Probably. That is the source of many problems. But to start narrowing this down, I have 3 suggestions:
1) temporarily (at least) change your inittab to default to runlevel 3 ... actually, is it currently set to 5 or 3? if it is currently 3 that would explain why slim doesn't start.
2) at a tty in runlevel 3 use "xinit" instead of "startx". Startx is fine most of the time, but it is essentially just a complex wrapper for xinit. That complexity can often iadd useful functionality, but it *always* makes troubleshooting more difficult. So for now just use a vanilla 'xinit'.
3) remove dbus-launch from your exec line in xinitrc. This is done by console-kit so it is redundant and potentially problematic. Further BOTH of these are taken care of by slim, so I'd even suggest getting both a jump start on being ready for slim and simplifying troubleshooting by removing both of them. Just make that line "exec openbox-session"
Edit: adding one more:
4) temporarily switch out openbox-session for openbox. I suspect the reason feh's setting of the background is getting overridden is due to a script or setting in openbox's autostart settings - many of these are only invoked when "openbox-session" is called, while "openbox" starts *just* the window manager itself.
Last edited by Trilby (2012-10-03 17:30:36) -
Home directories not fully created - AD with OSX server
Hope this makes sense.
I'm setting up a network in a school. We've an Xserve running Mac OS X Server 10.6.4. So that students can move seamlessly between our windows network and this, we've extended the AD schema and have the Server bound to AD. Clients are running 10.6.4, bound in a triangle with the Mac Open Directory and AD. So far, so good, all works fine.
I've been able to set preferences and network home paths with no major issues and scripted to get around problems with using iMovie. However as we've been awaiting some replacement hard drives to set up a new RAID, the home paths have been set to the share automatically created for Users - so afp://SERVER/Users
Now our new hard drives have turned up. The RAID is setup and working. I've created a new folder to store home paths - just to test with one user initially. I shared this path 'StaffData', enabled it for automount via afp, in protocol I've enabled guest access for afp. I copied the permissions set for the original /Users directory we were using. In WGM I've changed the home path for this user to afp://SERVER/StaffData, saved, then rebooted the client.
When I then login with this user it created the top level home directory - afp://SERVER/StaffData/USERNAME - and then a subfolder for /Library and /Desktop. No other folders are created (Music, Movies, Photos, Documents are all missing). I'm able to get it to generate Music when I load iTunes, but the same doesn't happen for iMovie or iPhoto.
I'm guessing its a permissions issue? When I switch the home folder back to the server's /User directory it creates all the home folders without any issues. Can anyone point me in the direction of a solution to this?Yep, I always get an error "The home directory could not be created because an error occurred". Always had that, even on the original /Users share that worked.
Kind of found a way around, have written a script to run at login that checks to see if Pictures, Movies, etc folders are present, and if it doesn't it just makes a new directory with that name. It's a bit of a bodge, but seems to still work. Would still love to have another proper fix eventually, but for the time being it's solved the immediate problem I had!
Thanks for your advice. -
Error 7 occurred at Create Folder in Create Directory Recursive.vi-
Recieved following message when attemoting to create source distribution
Error 7 occurred at Create Folder in Create Directory Recursive.vi->ABAPI Dist Create Directory Recursive.vi->ABAPI Dist Chk for Destinations.vi->ABAPI Copy Files and Apply Settings.vi->SDBEP_Invoke_Build_Engine.vi->SDBUIP_Build_Invoke.vi->SDBUIP_Build_Rule_Editor.vi->SDBUIP_Item_OnDoProperties.vi->SDBUIP_Item_OnDoProperties.vi.ProxyCaller
Possible reason(s):
LabVIEW: File not found. The file might have been moved or deleted, or the file path might be incorrectly formatted for the operating system. For example, use \ as path separators on Windows, : on Mac OS, and / on Linux.Hello,
Could you please list which options you are selecting when building a
source distribution (I am assuming you are using LabVIEW 8.0?).
Do you get this error when clicking on "Generate Preview" button when configuring source distribution properties?
Under "Distribution Settings" category, could you try checking the
"Disconnect type definitions and remove unuses polymorphic VI
instances" option and see if that helps with the build process?
Also I suggest Mass Compiling your VIs (Tools -> Advanced -> Mass Compile) before creating a source distribution.
If these do not help, could you attach your project with all the VIs it contains here?
Thank you and best regards,
Shakhina P.
Applications Engineer
National Instruments -
Hi
Is there a dictonary view where i can find all the "virtual directory" which are created with the "create directory" command ??
Thanks.ah.. :)
So I should add, that in general those view names are "plurals" (ending with an S), e.g. dba | all | user _ objects, tables, tab_columns, indexes, synonyms, triggers, sequences, users, and so on.
(And the v$ dynamic/stats view names are often in singular, like v$metric, process, session, datafile, tablespace - but this "rule" seem to be deteriorating with new views added). -
Geting error while creating a dir through CREATE DIRECTORY command
Hi Gurus,
When I'm trying to create a dir through this command with logged in as SYS
CREATE DIRECTORY pump_dir AS 'd:\temp\pump_dir';
I'm getting the error
Error starting at line 1 in command:
CREATE DIRECTORY pump_dir AS 'd:\temp\pump_dir'
Error at Command Line:1 Column:18
Error report:
SQL Error: ORA-00955: name is already used by an existing object
00955. 00000 - "name is already used by an existing object"
Any ideas how I can create a dir and grant access to a different user.
Thanks
Amitava.amitavachatterjee1975 wrote:
I checked and there is no such directory. I guess it is not that simple, the error I mean.Actually it is , please see,
ORA-00955: name is already used by an existing object
Cause: An attempt was made to create a database object (such as a table, view, cluster, index, or synonym) that already exists. A user's database objects must have distinct names.
Action: Enter a unique name for the database object or modify or drop the existing object so it can be reusedSo as Sb mentioned, check that which object is using the same name that you are trying to assign to this directory object and either rename or drop the object if you want to use the same name only. If not, you can always use another distinct name for this directory object .
Aman.... -
Hi, I have been having problems with Internet Explorer 8 using Windows 7 so wanted to install Firefox but unable to as get a message saying error creating directory c:\programme files (x86)\mozilla firefox\searchplugins
Thank you guig2! Followed your bleepingcomputer.com link above and found the problem was my permissions on C:\Users\Bill\AppData\Local/Temp. It was not "Full Control" for my User or Administrator. Updated the two lines to permit full control for folder, subfolder and files. Ran perfect.
-
Burrito install fail, trying to create directory in wrong place
Below is the error log from my attempted install. Of the 23 errors 22 are being unable to deleted things it never created. The error that seems to be the initial cause is this:
Unable to create directory "\\drnas02\users\CADU\gae04\..\Adobe Flash Builder Burrito Preview
\\drnas02\users\CADU\gae04 is a home directory I have on a network drive, but the installer isn't trying to create the directory there, it is trying to put it one dir up (with the ..) where I don't even have read permissions. I never specified the gae04 directory to the installer, but I assume its defined as some sort of application data directory as one other app created a directory there.
Here is the full error log.
Exit Code: 7
-------------------------------------- Summary --------------------------------------
- 0 fatal error(s), 23 error(s), 0 warning(s)
ERROR: 16101 Unable to create directory "\\drnas02\users\CADU\gae04\..\Adobe Flash Builder Burrito Preview
ERROR: 16101 Command ARKCreateDirectoryCommand failed.
ERROR: 16101 Unable to delete directory "\\drnas02\users\CADU\gae04\..\Adobe Flash Builder Burrito Preview". Error 2 The system cannot find the file specified.
ERROR: 16101 Error rolling back command ARKCreateDirectoryCommand
ERROR: 16098 Unable to delete file copy at "C:\Program Files\Adobe\Adobe Flash Builder Burrito\eclipse\configuration\config.ini" Error 3 The system cannot find the path specified.
ERROR: 16098 Error rolling back command ARKMoveFileCommand
ERROR: 16097 Unable to delete directory "C:\Program Files\Adobe\Adobe Flash Builder Burrito\eclipse\configuration". Error 2 The system cannot find the file specified.
ERROR: 16097 Error rolling back command ARKCreateDirectoryCommand
ERROR: 16035 Unable to delete file copy at "C:\Program Files\Adobe\Adobe Flash Builder Burrito\AMT\application.xml" Error 3 The system cannot find the path specified.
ERROR: 16035 Error rolling back command ARKMoveFileCommand
ERROR: 16034 Unable to delete file copy at "C:\Program Files\Adobe\Adobe Flash Builder Burrito\AMT\application.sif" Error 3 The system cannot find the path specified.
ERROR: 16034 Error rolling back command ARKMoveFileCommand
ERROR: 16033 Unable to delete directory "C:\Program Files\Adobe\Adobe Flash Builder Burrito\AMT". Error 2 The system cannot find the file specified.
ERROR: 16033 Error rolling back command ARKCreateDirectoryCommand
ERROR: 21 Deleting Registry Key - failure. Error 5
ERROR: 3 Unable to delete file copy at "C:\Program Files\Adobe\Adobe Flash Builder Burrito\FlashBuilder.exe" Error 3 The system cannot find the path specified.
ERROR: 3 Error rolling back command ARKMoveFileCommand
ERROR: 2 Unable to delete file copy at "C:\Program Files\Adobe\Adobe Flash Builder Burrito\.eclipseproduct" Error 3 The system cannot find the path specified.
ERROR: 2 Error rolling back command ARKMoveFileCommand
ERROR: 1 Unable to delete directory "C:\Program Files\Adobe\Adobe Flash Builder Burrito". Error 2 The system cannot find the file specified.
ERROR: 1 Error rolling back command ARKCreateDirectoryCommand
ERROR: The following payload errors were found during install:
ERROR: - Adobe Flash Builder: Install failedIndeed, our core installer team has agreed to supply the home folder path token we need for this fix, in time for the Burrito release.
I experimented with changing my own network Documents location a few months ago, and was able to move it down one level without much difficulty. The actual steps vary a little depending on whether you're on WinXP, Vista or Win7:
WinXP:
http://support.microsoft.com/kb/310147
Win7:
http://social.answers.microsoft.com/Forums/en-US/w7files/thread/fd508c30-7dad-4a7e-a652-ba 49828e5f0e
-Chris -
VMS, create directory and the chamber of secrets
Ok, here I am bumbling around in the dark. Here is the scenario I am developing an application using PL/SQL under the constraints of the SCT Banner web form system. The Banner function calls create the web page on the fly from data obtained with PL/SQL. What I would like to do is incorporate a java function into the web page. The only method available to me is via Banners function call twbkfrmt.p_printmessage (my_string); Here is the 'Plan' (caution: may be seriously flawed). I thought I could store my java code in a the CLOB field of a table, access it with a cursor and insert the code into the generated web page like so: twbkfrmt.p_printmessage (my_java_from_the_CLOB); I am having troubles loading the .js into my table. Here is how I attempted to accomplish this and the result (and to add insult to injury, it is on a VMS system!):
CREATE TABLE js_holder (
js_name varchar(30),
js_body CLOB );
CREATE DIRECTORY foos as 'USR$DISK:[CLEMENSD.SQL_EDIT]';
CREATE OR REPLACE PROCEDURE Load_CLOB IS
dest_clob CLOB;
in_file BFILE := BFILENAME('foos', 'supernote.js');
dst_offset number := 1 ;
src_offset number := 1 ;
lang_ctx number := DBMS_LOB.DEFAULT_LANG_CTX;
warning number;
BEGIN
DBMS_OUTPUT.ENABLE(100000);
INSERT INTO js_holder(js_name, js_body)
VALUES('supernote', empty_clob())
RETURNING js_body INTO dest_clob;
DBMS_LOB.OPEN(in_file, DBMS_LOB.LOB_READONLY);
DBMS_LOB.LoadCLOBFromFile(
DEST_LOB => dest_clob
, SRC_BFILE => in_file
, AMOUNT => DBMS_LOB.GETLENGTH(in_file)
, DEST_OFFSET => dst_offset
, SRC_OFFSET => src_offset
, BFILE_CSID => DBMS_LOB.DEFAULT_CSID
, LANG_CONTEXT => lang_ctx
, WARNING => warning
DBMS_LOB.CLOSE(in_file);
COMMIT;
DBMS_OUTPUT.PUT_LINE('Loaded File using DBMS_LOB.LoadCLOBFromFile.');
END;
then the following:
EOUTST> set serveroutput on
EOUTST> exec Load_CLOB
EOUTST> exec load_clob
BEGIN load_clob; END;
ERROR at line 1:
ORA-22285: non-existent directory or file for FILEOPEN operation
ORA-06512: at "SYS.DBMS_LOB", line 672
ORA-06512: at "BANINST1.LOAD_CLOB", line 13
ORA-06512: at line 1
EOUTST>Is the directory owned by the same schema that owns the procedure?
If not did you GRANT READ and WRITE to the proc's schema?
If so then you might want to create a simple external table to confirm that your directory and permissions are valid. -
Create directory utl_file errors
I thought that I would be able to answer my problem with all the help I've seen online. I don't seem to be able to.
I have the following code (snippet) below from my procedure:
v_file varchar2(100);
v_direc constant varchar2(30) := 'c:\output\';
v_testfile UTL_FILE.FILE_TYPE;
BEGIN
v_testfile := utl_file.fopen('C:\output', 'JohnsUIICounts.txt', 'w');
open csr_uii;
loop
fetch csr_uii into csr_uii_a, csr_uii_b, csr_uii_c, csr_uii_d;
exit when csr_uii%NOTFOUND;
utl_file.put_line(v_testfile, csr_uii_a || ' ' || csr_uii_b || ' '|| csr_uii_c || ' '|| csr_uii_d);
end loop;
I logged on to SQL Developer and did:
CREATE DIRECTORY V_DIREC AS 'C:\output\';
GRANT WRITE ON DIRECTORY V_DIREC TO PUBLIC;
I got the message back that the directory was created. When I go to the c:\ drive, I don't see the directory.
Any ideas? I've gone through all sorts of iterations like changing the drive from c to e, different folder names, upper and lower case, nothing works.
VictoriaThanks. Now that I understand that, I created the directory on the server. I reran the code. I'm still getting:
ORA-29280: invalid directory path
ORA-06512: at "SYS.UTL_FILE", line 33
ORA-06512: at "SYS.UTL_FILE", line 436
I notice that on the Windows Server, when I create the directory (as an admin user), I check on the properties, and it keeps staying read only. I can modify it, but the change doesn't save. I heard something about group permissions. Is it possible that the problem is because of permissions on the server? I would think that might be the real problem at this point.
Thanks,
Victoria
Edited by: user3804901 on May 20, 2009 4:31 AM -
How can I create directory(folder) in the file system with pl/sql. I know you can create file or write in to a file, in any folder in file system with utl_file. but what about creating a folder then a file in to it.
depending on your os/oracle version, you can use dbms_scheduler to do that.
ex in AIX5L/10.2.0.2
$ cat /tmp/x
#!/bin/ksh
mkdir /tmp/xxx
SQL> exec dbms_scheduler.create_job(job_name=>'createdir',job_type=>'EXECUTABLE',job_action=>'/tmp/x',start_date=>sysdate,enabled=>true)
PL/SQL procedure successfully completed.or you can use java
Maybe you are looking for
-
I can no longer access tesco bank after Safari upgrade
Since the recent safari upgrade when I attempt to login to my tesco bank credit card account I simply get a balnk white screen. Tesco say they have had other customers with this problem but cannot help which is nothing unusual!
-
While on a forum and trying to play an imbedded video, my ipad often kicks me back to the home screen. Happening ,or often since the latest upgrade. Any ideas?
-
Text is converted to image?
hi everyone, I've got text in a text box that is being converted to an image for some reason - actually I think I know why... The text has links in it! Text without links in it is ok - fine. Text with links - uh oh - make all links images! and if the
-
Hi all Am making use of define new in my combo box which opens me with a new form that enable me to enter values which are not mentioned in the combobox.Now when i make use of my mouse after defining new value my application works 100% but at same pl
-
TS140 install Windows 2012 on RAID 1
Hello, I'm planning to install a Windows 2012 Server on a TS140 using RAID 1 configuration. As I read in the manuals, RAID is most often used with CSM (Compatibility Support Module), but as Windows 2012 supports UEFI it could be used with drivers.Whi