RenameTo  move file questions

I tried to use the following to rename and move a flv file to a diffrent folder but it doesn't work.....I tried several combinations but can't seem to figure out how to do it.....could you give me some examples plz.
fileObject3 = new File("streams/"+insID+"/"+stream+".flv");
fileObject3.renameTo("streams"/"adName"/"+adName+".flv");

Looks like a syntax error.
This line
fileObject3.renameTo("streams"/"adName"/"+adName+".flv");
looks like it wants to be
fileObject3.renameTo("streams/"+adName+"/"+adName+".flv");
If that's not the problem, try inspecting the info from the Application.onStatus event.
I'm not sure if the renameTo method will create directories that don't exist. If that's the problem (Application.onStatus should tell you that), you can create the directory with the File class first, and then do your renameTo.

Similar Messages

  • Does File.renameTo() move files smartly or does it do a dumb copy/delete?

    I have to move very large files to a different folder within the same file system, in Solaris (actually a mounted NFS-based Filer - that supports NFS RENAME), instantaneously.
    This is possible if the O/S level call is smart enough to leave the physical file where it is and just change the file handle information.
    So... are Solaris and Java smart enough to do this automatically when we call renameTo()? Or is it using the brute force method?
    If it is using the brute force method, are there any issues I need to know if I use the exec() method to spawn a Unix process to do the move? (I ask because somebody in my office thinks that Java has problems with 'hung processes' when it spawns calls to Unix commands in Solaris - I have not experience this behavior personally)
    Thanks,
    Bruno

    I had tested, with a 100Mb file, all within a single filesystem, with the following results:
    Unix 'cp' command - on Solaris w/ Filer: 2-4 seconds
    Java renameTo() - on Solaris w/Filer: 4milliseconds
    Java renameTo() - on Windows w/LocalDisk: 0milliseconds (or more correctly < 1)
    From that it 'looks like' the renameTo() command when applied to moving a file withing a single filesystem will leave the file in place and simply change the file handle information.
    I posted because I wanted to be absolutely certain. There is a fairly dumb unix script that I have no control over to moves the files from my 'destination folder' into an archive. Corruption could have happened if the file was still being physically copied by my app (as opposed to the file handles) when the other process 'found it' in the directory and tried to grab it. But since - as you indicate - renameTo() only changes the file handles... that script can't see the file until it is fully available. Much safer.
    Thanks for the confirmation.
    Bruno

  • Move file question

    I have been working on a script that utilizes 'isight capture' app.
    http://osxdaily.com/2007/01/24/capture-isight-images-using-the-command-line/
    do shell script "DATE=`date '+%I.%M.%p-%h.%e.%Y-'`;
    FILE=~/Desktop/${DATE}Webcam.jpg;
    ~/bin/isightcapture ~/Desktop/${DATE}Webcam.jpg;
    if [ -e $FILE ]; then
    open /Applications/Preview.app $FILE;fi"
    tell application "System Events" to keystroke "z" using {command down, control down}
    (comment)
    ( this will make the window full sized and center the picture, (gasp, Windows Maximize) I found this on another website. I had to enable this by running this command in terminal
    "defaults write NSGlobalDomain NSUserKeyEquivalents '{"Zoom" = "@^Z"; "Zoom Window" = "@^Z"; }'"
    (comment)
    delay 4
    tell application "Preview" to quit
    I have so far figured out (thanks to google and other posters) how to get it to take the picture and then open the picture in preview for a short time. Now I am trying to figure out how to move the file. So if it is a good picture I would like to be able to move it to a more permanent folder instead of just the desktop. The problem is I have a hard time figuring out how to define it since the file name varies so much depending on the date and time. The only thing that is consistent is the last portion "Webcam.jpg".
    i.e. "01.33.PM-Apr.18.2010-Webcam.jpg"
    Can anyone help me with moving the file?
    Thanks in advance for any help.
    Sincerely,
    Michael~

    Thank you guys for helping me out with this one. I got it to go with the applescript. I couldn't figure out the shell script solution, I suspect I had a path error.
    Here is the final script:
    tell application "Finder"
    move (every file of desktop whose name ends with "Webcam.jpg") to trash
    end tell
    do shell script "DATE=`date '+%k.%M.%S-%h%e.%Y-'`;
    FILE=~/Desktop/${DATE}Webcam.jpg;
    ~/bin/isightcapture ~/Desktop/${DATE}Webcam.jpg;
    if [ -e $FILE ]; then
    open /Applications/Preview.app $FILE;fi"
    tell application "System Events" to keystroke "z" using {command down, control down}
    delay 4
    tell application "Preview" to quit
    tell application "Finder"
    set theFile to (every file of desktop whose name ends with "Webcam.jpg")
    end tell
    set question to display dialog "What would you like to do with the picture?" buttons {"Keep", "Trash", "Email"} default button 2 giving up after 5
    set answer to button returned of question
    if answer is equal to "Keep" then
    tell application "Finder"
    move (every file of desktop whose name ends with "Webcam.jpg") to "Macintosh HD:Users:Path:Path:Path"
    end tell
    end if
    if answer is equal to "Trash" then
    tell application "Finder"
    move theFile to trash
    end tell
    end if
    if answer is equal to "Email" then
    set file_attachment to theFile as alias
    tell application "Mail"
    set theMessage to make new outgoing message with properties {visible:true, subject:"", content:""}
    tell content of theMessage
    make new attachment with properties {file name:file_attachment}
    end tell
    end tell
    tell application "System Events" to set frontmost of process "Mail" to true
    tell application "Finder"
    move (every file of desktop whose name ends with "Webcam.jpg") to "Macintosh HD:Users:Path:Path:Path"
    end tell
    end if
    if answer is equal to "" then
    tell application "Finder"
    move theFile to trash
    end tell
    end if
    Thanks again for your help guys.
    Sincerely,
    Michael~

  • Question on how to move files in iTune Liabrary

    All my file types--music, podcasts, and audiobook--are located in Music folder in the Library. I wish to move podcast files to Podcast folder and audiobook files to Audiobook folder.
    After trying the intuitive Windows' methods like drag & drop, I searched both online documentations and preexisting discussions on the subject, but no avail.
    Does anyone know how I can move files (Podcasts and Audiobook) from Music folder to other folders in my Library ?

    Although I can not completely claim to understand your question, I think that you are concerned with how to put together two or more songs of the same Artists' group when each songs are loaded at different times. If that is your concern, I might have a suggestion.
    You can group two or more songs, added at different times, with various groupings. The varying groupings are by Artist, Album, Genre, etc. Since if you knew how to do it with one, then you can do other ways as well; let's pick Genre for my suggestion purposes.
    First, you need to select two songs that you wish to group together. You can select both of them by highlighting the first one, then the second one by clicking the second one while holding "Ctrl" button. You should see both songs highlighted.
    After both songs are highlighted, you want to edit information of both songs at the same time. To do so, you first need to get the Form called Multiple Item Information. You can get this form by first moving your cursor over one of the two highlighted songs, then "Right" click. You might get a dialogue box, which is to verify whether you really want to modify information on multiple items. When you get such dialogue box, click on "YES." After that, you should see the Form I mentioned--Multiple Item Information.
    In this Form, you might see some or most of the fields already filled. If not, you might want to manually type in whatever you wish. For our purpose of grouping them together, you need to modify two fields--Boxes named "Compilation and Gapless Album." For each of those boxes, you will want to select "Yes" from its drop-down menu. Each drop-down menu is located at the right corner of each Box. You will also want to fill in the check boxes, located on the left them, by clicking in them.
    After sequentially following all those steps above, you can now click on the "O.K." button of the Multiple Item Information Form. If you followed those steps successfully, you should see both songs grouped together.
    Any further help or clarification needed, reply back with your specific concerns to which I can try my responses.

  • Newbie question: integrating SWF, movie files

    Hi all!
    Thanks in advance for your help--I'm trying to use Flash to
    integrate several files into a slick screencast. Basically, I need
    to use Flash to play a movie file, then play a SWF file, then
    another movie file and be done. I was hoping to also put in some
    text and animation (PowerPoint-like, not too intense) in between
    those things, but can jettison that if that's difficult.
    I know the import command does wonders with one video, but
    I'm trying to use multiple types of files including SWFs, which is
    throwing me off a bit. I realize I'm being incompetent here, but if
    anyone has any suggestions, I'd really appreciate it. And this goes
    without saying, but I don't mind coding at all.

    I strongly recommend you to use Compressor. It is easy to use and there a lot  of presets.

  • Newbie question: How to share large QT movie files exported from FCP X?

    Well, I've navigated through FCP X for the first time and I now have 16 QuickTime movie files I have exported from FCP X. Each file is a song from a live band performance. The files are:
    - Apple ProRes 422
    - 1920 x 1080
    - 24-bit
    - Frame rate 29.97 fps
    Now I need to share these files with the band members. They will use them for two purposes:
    - Watch, as feedback on their performance. In this case, I'd like to preserve the quality as much as possible
    - Put some of the movies on YouTube, where quality will be lost, of course. They may post only short clips from the songs.
    These 16 .mov files total 115GB. The smallest is 6.5GB, the largest is 13.9GB.
    The quality of the movies is fantastic, both video and audio. I cringe to think about degrading the quality............but I have the practical problem of how to get the files to five different band members.
    I normally distribute audio files I've mixed in Pro Tools via DVD-R discs, but the files are much smaller.
    What are my options for sharing the files?
    Do I need to use an application like Compressor to compress the files (ugh) to get them onto multiple DVD-R's?
    I would assume this is a common problem that all FCP X users deal with.

    I strongly recommend you to use Compressor. It is easy to use and there a lot  of presets.

  • How can I move file from one path to another   by java

    Hello
    I need to move the following file c:\abc\aa.txt
    to the follwing path c:\def
    How can i do it by java program?
    Regards

    Hi,
    Try the following code:
    boolean moveFile = new File("c:\\abc\\aa.txt").renameTo(new File("c:\\def",
    new File("c:\\abc\\aa.txt").getName()));
    Hope that helps.
    Savitha.
    OTN group@IDC

  • Is there a program I can use to retrieve corrupted .MOV files, from a HD memory card where some files will open, and others wont?

    Hi,
    I have a Mac OS X version 10.6.8 with a 3.06 GHz Intel Core 2 Duo processor and 4 GB 1067 MHz DDR3 memory.
    I have recently shot some still and moving footage on my Cannon EOS 500 D (digital camera) using an AMICOE SD C10 8 GB high speed memory card.
    After uploading these photos and movies onto my Mac, I am only able to open about 2/3 of the files that appear on the screen.  In the case of the movie files, I can see a number of the file icons, however about 1/3 of them will not open (I get a message saying that Quicktime does not recognise this file - yet it is a .MOV file. Interestingly I can see a small thumbnail for each of these files that will not open, however I am unable to expand the thumbnail into the larger size) and there are a number of photos that simply do not appear as a file or thumbnail.
    Is there a program I can use to retrieve these corrupted .MOV and JPEG files from either my computer or the memory card?
    Thank you for your interest in this question.
    Cheers,
    Shaughno.

    ....to add to the last part... When adding to the iTunes library,- I need iTunes to make a quick-scan to verify that media I am adding isn't already in there,- preventing duplicates that make remedial tasks of removing* duplicates so annoying and unproductive...

  • Converting mov files to animated gifs

    Basic question: how-to convert MOV files to animated GIF files. I have been searching for free/opensource/shareware to do this but so far no program I found could do this.
    I'd love someone to answer, definitively, about free/opensource/shareware, but my hopes are down.
    So, I ask what MAC program (even if I have to buy it) will let me convert MOV files to animated GIFs or MOV frames to seperate images (is that at all possible?).
    Secondly, does anyone have experience with software that does this?
    Thanks in advance.

    Quicktime Pro 7 can take video (ie mov files) and export them as image sequences.
    It can be purchased at the Apple store for $30.
    http://store.apple.com/us/product/D3380Z/A
    x

  • Firefox won't load .mov files online but plays them locally: QT problem?

    My website has several pages with embedded .mov files, which used to play perfectly well, but now only give a question mark after the progress bar fills up.
    For example, one of these pages is http://www.paulozelinsky.com/shivers-animation2a.html
    Firefox can open this and similar pages that are stored in my computer (on a mirror of the site) and view the animations normally. But online it doesn't work. Typing the path to the online animation file into Firefox's URL field also produces an empty QuickTime window with a question mark, so it's not a matter of the page code.
    Is it possible that QuickTime's plugin isn't compatible with Firefox, at least for .mov files like mine? (Created with After Effects 7, using Sorensen 3 codec). Does Firefox use plugins in the same way for playing a file on a web server as playing it in a local folder? Or could there be something going on with my web host?
    I would at least like to know if this failure to load the animation is the same for other Mac Firefox users. I have heard that the animation does load, though slowly, for at least one PC Firefox user.
    When I first noticed the change, the problem was occurring in Safari as well as Firefox, but now it is only in Firefox.
    I have Firefox 3.6.8, and in HD/Library/Internet Plug-Ins I have QuickTime Plugin.plugin v. 7.6.6. I also see in there something called nsIQTScriptablePlugin.xpt.

    Bump, bump. Please can anybody help?

  • Can't play HD .mov files (in Quicktime, iMovie, or FCP)

    Hello,
    My Powerbook (bought in 2004) is senile and having various problems (see below for more details), so perhaps this issue can't be fixed without fixing the other stuff (or getting a new computer)... but just curious.
    I'm helping a friend with a video project, and he brought over his small Lacie external HD with his footage on it-- recorded with an HD video camera, then imported into iMovie HD, now simply a bunch of .mov files in a folder.
    When I try to open of the files with Quicktime Pro, it gives me a white screen and plays the sound, and tells me the "component is missing", and that i can try to find it on the Qcktime site, but I couldn't figure out which Codec to try (and you have to pay for them all?). I also tried updating my Quicktime to 7.4, and the exact same thing happens.
    When I try to open them with iMovie 4.0.1, it says "Can't open [this file]; skipping and continuing".
    When I try to open them with FCP 4.5 HD, it says "Codec Not Found, you may be using a compression type without the corresponding hardware card"
    Any ideas? Should I try erase-and-install with my whole system, after a backup onto my own external HD? I can't reinstall FCP because my disks are in America (I'm in Hong Kong), but even if it doesn't work with that, is there a way to make it work in iMovie?
    Thanks very much--
    Samantha
    PS- Background on my computer troubles of late-- in December I was having some problems with various things, which led me to try and repair the hard-disk, which didn't work. Some of my questions/conversation are on this thread.
    http://discussions.apple.com/thread.jspa?threadID=1256737&tstart=0
    Then for Christmas I bought DiskWarrior, ran it, but it couldn't repair the disk/replace the system because of some "error". Which makes me think I have some serious Hard-disk problem-- although the hardware seems fine according to SMART. So right now i'm just trying to get through a few of these big projects before trying erase-and-install with my whole system, and if that doesn't work, then probably investing in a new computer. Time to upgrade perhaps.
    Was having some weird problems before, so ended up getting DiskWarrior,

    Hi-
    Referring to this post:
    "The AIC codec is installed by iMovie HD and is just what its name implies. Intermediate (temporary conversion from one file format to another).
    Your G4 will not be able to play the file past a few frames per second because of the large dimensions and high data rate even if you did find the codec. You'll find editing it using QuickTime or iMovie a frustrating experience because of those facts."
    I'm a little confused-- do you mean that the G4 computer is just not strong enough to edit HD files "even if I did find the codec"? I was planning to edit it with Final Cut Pro (have never edited a HD project before), but is my computer not adequate? Let me know if there is any way for me to tackle an HD project with my current laptop-- otherwise I guess I really need to look into a new one.
    -shc

  • Need help with easy script for open / close app and move files

    Hi,
    I'm not a scripter.. never done anything special perhaps more complicated than /shutdown -s on cmd..
    I actually learned ASCII C language on university but never used it in real.
    I'm trying to create a basic script that perhaps you could help me or guide me how to do it..
    The commands are
    1) Close a running app (end task it or force kill it, I prefer end task it)
    2) delete files from x location
    3) run .exe app from y location
    4) close that running app 
    5) move files from z to y
    Perhaps adding few "wait few seconds" commands in between each, so the apps will launch successfully..
    My first question will be whats the easiest script language to do that?
    I tried VBScript but couldn't find commands for open or close apps.. also for controlling files..
    And what commands can do that? I could google them up for better understanding no need for rough guide
    And lastly, does it too hard? If it takes more than hour to make it (learn and process) than it ain't worth it..
    Thanks alot ahead!
    Jordan.

    hmm 2 questions:
    1) taskkill.exe causing me access deny error.. I used "taskkill.exe /IM softwarename.exe"
    how do I get permission or something to fix that?
    2) on the "move" command..
    First, its a "copy" instead.. but I easily figured that out.. 
    but more important is that I want to copy a folder.. with unknown list of way too long files and sub folders..
    and all I see is ability to move a file..
    Is this possible?
    Thanks

  • How do I use m2ts movie file format from my old pc with FCP on my mac?

    I have recently moved from a PC to a iMac. I have a large number of Sony AVCHD movie files, which were imported to my PC and are in the m2ts file format on my PC. The original files on my Sony camera were deleted so these files are now all I have. Also, for each movie clip on my PC there are 3 files....a very large m2ts file along..... with two very small file....one is a .modd file and the other a .moff file.
    I now want to use these m2ts files (and if needed possibly these other two smaller files) on my Mac make movies with either iMovie or Final Cut Pro. and don't know how to import them or convert them for use on my Mac. Can anyone help?
    One final question. Can FCP author DVD's or is separate software required. Apple has discontinued iDVD for iMovie (which I find rediculous) and so I'm worried they don't support making DVD's with FCP.
    Thanks

    Although I don't use Toast I know lots of people who do and like it for a variety of purposes; for example, many people author in DVDSP and burn disks using Toast. But there are a lot of versions and they have differing features and capability. Do a search in these (or iDVD) forums you'll find plenty of info. Don't know about the other app. Again, if you ask Apple, they may come through with iDVD…they have for others.
    Clipwrap quality limitations? Try the trial and test the results for yourself. As far as I know the trial is fully freatured but there is a one minute clip limitation (which doesn't apply to the paid version).
    Good luck.
    Russ

  • Can you move files back and forth between an iPad and a PC using iTunes?

    If I read this article correctly, http://support.apple.com/kb/ht4094 I should be able to connect my iPad to my PC, fire up iTunes and then on the Apps tab in iTunes I should be able to click on an app, Pages for example and then just drag files onto the Pages Documents column from a Windows Explorer window.
    This is great.  I was hoping to use DropBox but it is such a hassle I don't know why people are so thrilled with DropBox on iPad.  If I can just move files back and forth using iTunes that should be fairly easy.  I wish there was a way to just upload my files to iCloud from my PC but the iCloud control panel app for Windows only seems to connect Outlook, Photostream and Bookmarks. I want to be able to just carry my iPad and not have to deal with a computer. 
    I thought that they said that you didn't need to have a computer to have an iPad.  I guess if you have a computer and then GET an iPad its a different story, unless you have a Mac of course.
    Anyway my question is: can you move files back and forth between a PC and an iPad using just iTunes?

    I still need to do some trial and error testing with DropBox and my iPad.  But can I link my iPad to my DropBox account so that I can always see the files on DropBox when I open Pages on my iPad?  I just want one place to store my documents, and iCloud doesn't seem to be up to the task when it comes to opening a fil;e, editing it and then saving it back to iCloud.  I just want a networked storage location that works like a networked drive on my LAN.
    I realize that hollywood and the music industry are up in arms about file sharing on the Cloud which is why so many things are made more difficult than they need to be. 

  • Capturing multiple video streams into a movie file

    I am using QTKit to capture 3 media streams simultaneously: audio, video, and display (display is screen capture), and would like to capture them in a time-synchronized fashion to a single .mov file.
    I have been able to successfully capture these three streams to 2 separate .mov files by using 2 QTCaptureSessions (one for audio/video, one for display video), but the problem here is that the 2 files are not time-synchronized (I have no idea how to synch them after the fact).
    The more intuitively correct thing to do is to use a single QTCaptureSession instance with 3 inputs (2 video inputs and one audio) to do the capture, which should automatically synch all the streams. Furthermore, since the .mov file can support an arbitary number of streams, I figured wiring up the QTCaptureSession to output to a single .mov file would be easy. I was wrong.
    The problem is that even though my QTCaptureSession has 3 nice input connections (2 video and 1 audio), when I wire up a QTCaptureMovieFileOutput to it, the resulting QTCaptureMovieFileOutput object has ONLY 2 connections: a single video and a single audio.
    Here is snippets of what I am doing:
    // add audio input: (type of media is QTMediaTypeAudio), succeeds
    [qtSession addInput:[QTCaptureDeviceInput deviceInputWithDevice: qtAudioDevice] error:&qtError]
    // add video input: (type of media is QTMediaTypeVideo), succeeds
    [qtSession addInput:[QTCaptureDeviceInput deviceInputWithDevice: qtVideoDevice] error:&qtError]
    // add display input: (type of media is QTMediaTypeVideo), succeeds
    [qtSession addInput:[QTCaptureDeviceInput deviceInputWithDevice: qtDisplayDevice] error:&qtError]
    // create file output
    QTCaptureMovieFileOutput * qtFile = [[QTCaptureMovieFileOutput alloc] init];
    [qtSession addOutput:qtFile error:&qtError];
    // PROBLEM: if I look at this array of connections, it has ONLY 2 connections
    // 1 video, 1 audio!!!
    NSArray *connections = [qtFile connections];
    // start capture running
    [qtSession startRunning];
    // wire up to my file
    [qtFileOutput recordToOutputFileURL:[NSURL fileURLWithPath:outputFileName]];
    I desperately need help....my questions:
    1. Since QTCaptureSession supports arbitary inputs, and QTMovie supports arbitrary # of streams, I can't believe it's not possible for me to simply "hook" all the inputs of QTCap to output connections that will write to streams in one movie file. Clearly, QTCaptureMovieFileOutput is not doing this...can anyone tell me how to do this? This can't be hard, right?
    2. If I have to fall back on the ridiculous approach of capturing 2 unsynchronized .mov files and somehow synching them after the fact, can anyone provide a pointer on how to do that?
    Thanks VERY much!
    Steve

    As posted by Andy Mees...
    perhaps more realistic (and fcp friendly) would be this:
    http://www.virtualvtr.com/pictureready/index.html
    or this gem that popped up on the LAFCPUG boards a few days ago ... well worth a gander
    http://www.softronmedia.com/products/products/mvr.html
    ...in this thread...
    http://discussions.apple.com/thread.jspa?messageID=5968334&#5968334
    Hope that helps,
    K

Maybe you are looking for

  • Sockets Connection Problem

    Hi I have this problem,sometimes i manage to connect to a server using sockets but sometimes it does not want to connect.cany please tell me what do you think the problem could be since sometimes it manages to connect sometimes. Pls

  • Enhancing a TYPES definition in a TYPE-POOLS

    I'm trying to add a new field to the following type: shipment cost document item TYPES: BEGIN OF V54A2_VFKP.          INCLUDE STRUCTURE VFKP. TYPES:   ACR_AMT_LOCC LIKE VFKP-NETWR,          ACR_AMT_FORC LIKE VFKP-NETWR,          INV_AMT_LOCC LIKE VFK

  • 2110 printer ERROR message - remove and check cartriges

    I replaced black cartrige twice and still message - the color cartrige i did not replace however I'm only printing in black and have done this before with no problem- why cant i get this message to go away or am i missing somthing

  • EReaders 101

    What is an eReader? An eReader (short for electronic reader) is a handheld device for storing and reading books.  There are a lot of options out there, but we have a few tips for picking the right eReader. What screen is right for me? eReaders have o

  • How do u validate the data

    Hi I want to know Validate the data after extracting from R/3 to BW. Can any one of u please help me how should i go about this.. If the annswers were given step by step briefly the full points wil be rewarded.... waiting for the answrs