|
SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Help with moving file in Java using renameTo()
I am trying to move files to a new directory in java and I am having issues as I am not very familiar with creating/moving directories/files in java.
I am using renameTo() here is an example of code File = ("pic.jpg") Dir = ("fanartfolder") I then use boolean filecopied = File.renameTo(new File(Dir,File.getName())); I then check with the boolean wether or not it is done. My question is does the directory have to exist or do I need to create it in java as well before copying files into it? or will it create the directory when I copy files regardless? TIA |
#2
|
|||
|
|||
Okay answered my own question the directory has to exist. No off to figure out how to create the directory
|
#3
|
|||
|
|||
Okay I keep getting failures on trying to create directorys I am using the following
Code:
String dir = "directory path" (ie "\\\server\\movies\\test") File fdir = new File(dir); if (fdir.isDirectory() == false){ boolean dirmade = fdir.mkdir(); I check the return of dirmade and am always getting false. |
#4
|
|||
|
|||
Jeff helped me with this for those interested i needed to check again existance ( exist() )not isdirectory.
|
#5
|
|||
|
|||
Yo may also want to look at fdir.mkdirs(); (S at the end)
__________________
TV: Samsung UN46D8000 Server: Intel Core i3 540, 4G RAM, Matrox G450, 70GB EXT3 encrypted software RAID1 system drive, 1TB XFS tv recording drive, 2TB EXT3 encrypted data drive mirror across 2 machines, 2TB EXT3 encrypted media drive mirror across 2 machines, CentOS 6 64 bit, Experimenting with DNLA servers 1Gb wired network Disconnected after G day[HD 100 Media Extender, Placeshifter 7.x, SageTV 7.x, HDHomeRun] |
#6
|
|||
|
|||
I took a look at that thanks.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
java file access from an extender | jphipps | SageTV Studio | 7 | 06-11-2009 08:55 PM |
Feature Request: Archived file moving | maninblack_30 | SageTV Beta Test Software | 0 | 12-01-2008 03:59 PM |
Java error - file attached | stani | SageTV Software | 0 | 11-05-2007 10:33 AM |
Screwed up moving files (java error) | k9k9 | SageTV Software | 2 | 04-20-2006 07:00 PM |
Moving video file to another disk | hamptonhills | SageTV Software | 1 | 11-29-2003 09:49 AM |