Iphoto randomly renaming file on save

I was trying to figure out how to get my edited images from iPhoto on my iPad onto Lightroom on my Mac.
So I Shared a couple of the edited images to Camera Roll.
Now when I connect my iPad to my Mac and look at them in the import dialogue in Lightroom, it appears that the save process has randomly renamed the files. What was originally  img_0127.cr2 has now become img_0169.jpg - but there is another different image right next to it that is also called img_0169.jpg. If I make further changes and save them, the file is renamed yet again and is now img_0172.jpg.  The original raw file is still there with its original name, but I suspect that the metadata has been changed as Lightroom thinks it is a new file even though I have already downloaded it from the CF card.
Would it not be more logical to name the saved jpg files as img_0127-1.jpg, img_0127-2.jpg etc ?

I was trying to figure out how to get my edited images from iPhoto on my iPad onto Lightroom on my Mac.
So I Shared a couple of the edited images to Camera Roll.
Now when I connect my iPad to my Mac and look at them in the import dialogue in Lightroom, it appears that the save process has randomly renamed the files. What was originally  img_0127.cr2 has now become img_0169.jpg - but there is another different image right next to it that is also called img_0169.jpg. If I make further changes and save them, the file is renamed yet again and is now img_0172.jpg.  The original raw file is still there with its original name, but I suspect that the metadata has been changed as Lightroom thinks it is a new file even though I have already downloaded it from the CF card.
Would it not be more logical to name the saved jpg files as img_0127-1.jpg, img_0127-2.jpg etc ?

Similar Messages

  • Incorrect importing of photos in AP3.0.1?? Randomly renamed files? Dates?

    Gday..
    Been reading these threads so apologies in advance if this is covered elsewhere.. I like others upgraded from AP3.0.0 to AP3.0.1.. and initially things went well: processing sped up, Swap memory stays a manageable 1~2GB (or less). Couple of problems I am wondering if anyone else has or has found a work out for;
    a) I've just imported 251 Nikon D300S RAW photos into AP3.0.1 and I go to edit them... and I get a message when I click on Inspector saying "This photo has been adjusted using a previous version of Aperture".. which is curious because I literally just finished shooting for the day. And its a new SDHC card. All I did was put the card into my SDHC Card Reader (like my other 82GB of shots) which is set to open directly into AP3.0.1... The whole "import" process seems flawed??
    b) Anyone else have files that have been randomly renamed? I've got a bunch (like around 1000) that have become incomprehensible random letters? As opposed to DSC_0000 or something like that
    c) Dates: You can sort your imports by date. I figure today's should be first? No. I had to go digging through 4 years of photos for today's imports.. They were literally all over the place. And my camera is CORRECTLY set up re dates etc (I just triple checked)
    d) Anyone else having their Vault folder appearing suddenly under "Projects and Albums"?. Never happened under AP2..

    Gday..
    Been reading these threads so apologies in advance if this is covered elsewhere.. I like others upgraded from AP3.0.0 to AP3.0.1.. and initially things went well: processing sped up, Swap memory stays a manageable 1~2GB (or less). Couple of problems I am wondering if anyone else has or has found a work out for;
    a) I've just imported 251 Nikon D300S RAW photos into AP3.0.1 and I go to edit them... and I get a message when I click on Inspector saying "This photo has been adjusted using a previous version of Aperture".. which is curious because I literally just finished shooting for the day. And its a new SDHC card. All I did was put the card into my SDHC Card Reader (like my other 82GB of shots) which is set to open directly into AP3.0.1... The whole "import" process seems flawed??
    b) Anyone else have files that have been randomly renamed? I've got a bunch (like around 1000) that have become incomprehensible random letters? As opposed to DSC_0000 or something like that
    c) Dates: You can sort your imports by date. I figure today's should be first? No. I had to go digging through 4 years of photos for today's imports.. They were literally all over the place. And my camera is CORRECTLY set up re dates etc (I just triple checked)
    d) Anyone else having their Vault folder appearing suddenly under "Projects and Albums"?. Never happened under AP2..

  • IPhoto 08, Raw files wont save as Tiff

    I have set my preferences to save Raw files as tiff's after editing, however it will only save as jpeg, anyone have any ideas whats causing the problem

    neilmc
    Start with the basics: try each of these in turn:
    1. Repair Permissions using Disk Utility
    2. Delete the com.apple.iPhoto.plist file from the home / library / preferences folder. You'll need to reset your User options afterwards.
    3. Create a new account (systempreferences -> accounts) and see if the problem is repeated there. If it is, then a re-install of the app might be indicated. If it's not, then it's likely the app is okay and the problem is something in the main account.
    Regards
    TD

  • I have over 60,000 photos in my iPhoto.  When my screen saver comes on it randomly shows certain photos.  Often, these photos are old and I in turn find the desire to print said photo.  Is there a way the screen saver can convey a photo file name as well?

    I have over 20,000 photos in my iPhoto.  When my screen saver comes on it randomly shows certain photos.  Often, these photos are old and I in turn find the desire to print said photo.  Is there a way the screen saver can convey a photo file name or location as well?  Can I create a slideshow of all my photos to cycle through at leisure with photo info?  Lastly,  I know I have duplicates and have tried numerous software programs to delete duplicates to no avail.  What do you recommend as a method to reduce duplicates on iphoto?  Thanks for your time.

    1. No.
    2. Yes.
    3. Some apps for dealing with duplicates in iPhoto
    iPhoto Library Manager
    Duplicate Annihilator
    Decliner
    iPhoto Duplicate Cleaner

  • Save .PDF back to SharePoint, Acrobat is renaming files

    My problem is that Acrobat is renaming and also creating a new PDF file with both a random filename, when I save a .PDF file witch is checked out in SharePoint.
    I'm trying to find a way around the problem that we cannot save a .PDF file back to SharePoint. Because Adobe Acrobat cannot handle Webdav, I’m glad that Microsoft SharePoint haves a build-in features that enables us to open files in explorer, just like you access a network dive. So I`m using this option to open a .PDF file and save it back to SharePoint.
    This all works but only when a file is not checked out in SharePoint. When a file is checked out (by me) and I save the file. Acrobat gives me the error: “The document could not be saved. Cannot save to this filename. Please save the document with a different name or in a different folder.”. It then first creates a new file with the name “aaa04588” (without the .PDF extension). And then it renames the original file to “aab04588”.
    The file “aaa04588” contains all the changes I have made. The file “aab04588” is the same (old) file and is still checked out (by me).
    I have no clue what Acrobat is trying to do.
    When a file in SharePoint is checked-out by another user, adobe acrobat gives me the nice notice “There was an error opening this document. Lock violation.”. It then refuses to show me the document, where I would expect to open in read only mode.
    I have tried to simulate this with other programs, but they all handle correctly by just overwriting the file or open in read only mode. This is also what I expect.
    I`m using the latest version of Adobe Acrobat 9 Pro Extended, version 9.3.3. I have tested It on MOSS 2007 and SharePoint 2010.
    I hope someone could help me find the problem that causing this.

    There is also a free plugin for Acrobat called “Swiftwriter” from the company omtool. The disadvantage of this plugin is that it does not remember from where the .PDF file is opened. Therefor you need to click trough the complete SharePoint sites and lists to save your work back to SharePoint.

  • Random Rename Of Files

    Is there a way to randomly rename a folder full of images?
    I have about 300 in a folder that I would like to jumble up then create a web photo gallery from them.
    But I do not want them in file name order, just random.
    Thanks
    Mathias

    Probably could do with a script, but I know nothing of them.

  • Scanning into iPhoto -where are files landing, and how to get copies?

    Maybe if I describe my current situation, I can better understand what a good way of maintaining the archive of photos I've kept for 13 years is in a cross-platform manner. I just scanned a photo, and chose to tell the scanning software to send it into iPhoto. There it ends up in the package, in folders like Originals>>2009>>May 25, 2009 and May 25, 2009_2 for the second scan, etc, etc.
    So I can either copy the files that are in those folders to the desktop, taking care not to remove or delete them, and then push them into my archive in the folders I want them, or I could save out each one as it hits iPhoto, using the Export function. I've got 18 years of film photos I'm going through to add to my digital archive the best memories of my wife, who recently passed. So if I find one of us at Fallen Leaf Lake in 1995, I want to shove it into my archive folder in a folder called 1995, and it's subfolder Summer. iPhoto has been a godsend in this project, but I also want to continue maintaining my application-independent archive, and am thinking that maybe saving out each photo as it hits iPhoto is the way to go. And is it possible I'm just not getting how to scan a bunch of related photos at once and have them all land in the same folder or event?
    With every photo getting it's own folder in the package, today's date in the metadata, and it's own new "untitled event", I'm finding it difficult to make much progress.

    DBoy wrote:
    Okay I've figured out a way to work with the scanned photo files before iPhoto. But what do I do to get them into iPhoto in a way that makes sense? I've got film-only photos I need from around 1990 all the way up till the recent past. So I'm looking at nine photos of my wife at our daughter's first birthday. To pull them into iPhoto without creating a bunch of folders, events, with today's dates.... Should I put them into folders with descriptive names in the hopes that that will cause iPhoto to assemble them into an event by that same name?
    That is a good idea
    drag the folder onto the iPhoto icon in the dock to import all of the photos in it as an event with the folder name
    Also you can use file names (name managler - http://www.manytricks.com/namemangler/ -is a good program for renaming files) before importing to iPhoto
    And use some kind of metadata editor to assign dates before pulling them into iPhoto? I whacked my entire iPhoto library a few days back over this this and some other sets of photos, because once I got them into the same "event", I used Command+A to select them for a date change. However that did not select all the photos in the event, it selected all the photos in the library. Then the date change put everything out of whack for all the photos - apparently it adds or subtracts to the Julien dates, so instead of making everything that certain date, in this case it adjusted all photos to lose about ten years.
    You used adjust them and date - it adds a constant delta to the dates which does not work for scanned photos since they have no "date taken" - you want the batch change time and date to change all selected photos to a specific date and time (with the possibility of adding an increment to the time)
    LN

  • List of downloads is blank after I changed the file to save to. How can I restore the list of downloads?

    I have already tried the all the steps in this link.
    '''http://support.mozilla.com/en-US/kb/Downloads%20window%20is%20blank?s=+downloads+list&as=s'''
    I have changed the file to save to back to the original one as well.

    Try opening the problem files using a text editor or file viewer to see what the first few bytes contain. All valid FM binary files for FM 11 will contain <MakerFile 11.0> in the first bytes of the file.
    When updating books, it's sometimes better to just to create a new book file and add the files to that.
    When renaming files in a book, changes at the system level will break any links/cross-references between files, so it's always best to use the Rename option in the Book file to change FM file names. This will maintain the correct linkages.

  • Rename file name & format using ftp sender

    Hi all,
    This is regarding the renaming of file at sender file(FTP) communication channel and placeing the same file in the same folder.
    At FTP server at sender side (i.e.clients place) is in .txt format.But now .txt file has to rename and change into .sav foramt with below required name convention of file.
    client format is  :  SAP_Order.txt (Pervious file name).
    We need to change the file in to "SAP_Order_yyyymmddThhmmss.sav" format..
    How can i achieve this requirement?
    Can please suggests me solutions ASAP.
    Best Regards,
    satya,

    Hi,
       if your requirement is to pick the  existing file in the FTP folder...and send as idoc to the target and place the renamed file to FTP folder...
    then its simple...
    use two receivers instead of one , one for point to target and other for sender itself... (second receiver  is for  changing  the file name format....)
    Hope the above understanding is correct...if not provide more details of your requirement...
    HTH
    Rajesh

  • Deleting & renaming files - is there a shortcut to finder?

    I am a recent convert from PC to Mac. So far so good. However, one thing starts to drive me up the wall which is deleting/renaming files in programs such as photoshop, word, excel etc.etc.
    As far as I can tell, this is only possible in the finder menu. Is this Correct? I am using a lot of folders and subfolders - sometimes 3-4 levels deep. Every time I need to change/delete a file or filename - lets say while in photoshop, I have to go to finder and click my way through several levels of folders to the actual file I need to change. This is somewhat annoying and timeconsuming.
    Question 1: is there a way to do these operations in - lets say photoshop directly?
    Question 2: If not, is there a shortcut key that would point me automatically to the file in finder where I can make the changes?
    Your input would be very helpful and save me some aggravation.
    fupe

    Hi Greg,
    Thanks for your input. You are correct as far as "save" and "save as" is concerned. Windows and Mac work the same way.
    However, as far as I can tell, in Mac you can only "delete" or "rename" a file in "finder" which forces you to open up finder and locate the file in order to delete or change it.
    In windows you can do these 2 functions directly in the program (such as photoshop, excel or words). You do not have to go to "explorer or root directory" to make these changes which I believe would be the equivalent of "finder".
    In any case, Terence solved the problem. By command clicking the name (title) of the file in any program, it opens up the directory in "finder". This way makes it easy to select the file and do the changes.
    fupe

  • Rename file extension during a file upload ??

    I need to rename the extension of a file at some point during the file upload. I am not sure where to do this at.
    The file needs to be renamed before it is written to the directory.
    Basically, the file will come in with a .txt or .doc type. Based on a users profile, I will change the type to a non-relavent number such as 1111.
    Here is my upload servlet. Can you tell me where to change the type so it will write the file with the new extension?
    Thanks.
    public class FileExport {
    //restrict upload files to 1 Meg
    private static final int DEFAULT_MAX_POST_SIZE = 1024 * 1024;
    private static final String NO_FILE = "unknown";
    private HttpServletRequest req;
    private File dir;
    private int maxSize;
    private Hashtable parameters = new Hashtable(); // name - Vector of values
    private Hashtable files = new Hashtable(); // name - UploadedFile
    public FileExport(HttpServletRequest request,
    String saveDirectory) throws IOException {
    this(request, saveDirectory, DEFAULT_MAX_POST_SIZE);
    // request the servlet request
    // saveDirectory = directory in which to save any uploaded files
    // maxPostSize = maximum size of the POST content
    public FileExport(HttpServletRequest request,
    String saveDirectory,
    int maxPostSize) throws IOException {
    // check values
    if (request == null)
    throw new IllegalArgumentException("request cannot be null");
    if (saveDirectory == null)
    throw new IllegalArgumentException("saveDirectory cannot be null");
    if (maxPostSize <= 0) {
    throw new IllegalArgumentException("maxPostSize must be positive");
    // Save the request, dir, and max size
    req = request;
    dir = new File(saveDirectory);
    maxSize = maxPostSize;
    // Check saveDirectory is truly a directory
    if (!dir.isDirectory())
    throw new IllegalArgumentException("Not a directory: " + saveDirectory);
    // Check saveDirectory is writable
    if (!dir.canWrite())
    throw new IllegalArgumentException("Not writable: " + saveDirectory);
    // Now parse the request saving data to "parameters" and "files";
    // write the file contents to the saveDirectory
    readRequest();
    public FileExport(ServletRequest request,
    String saveDirectory) throws IOException {
    this((HttpServletRequest)request, saveDirectory);
    public FileExport(ServletRequest request,
    String saveDirectory,
    int maxPostSize) throws IOException {
    this((HttpServletRequest)request, saveDirectory, maxPostSize);
    // Returns the names of all the parameters as an Enumeration of
    // Strings. It returns an empty Enumeration if there are no parameters.
    public Enumeration getParameterNames() {
    return parameters.keys();
    // Returns the names of all the uploaded files as an Enumeration of
    // Strings. It returns an empty Enumeration if there are no uploaded
    // files. Each file name is the name specified by the form, not by
    // the user.
    public Enumeration getFileNames() {
    return files.keys();
    // Returns the value of the named parameter as a String, or null if
    // the parameter was not sent or was sent without a value.
    public String getParameter(String name) {
    try {
    Vector values = (Vector)parameters.get(name);
    if (values == null || values.size() == 0) {
    return null;
    String value = (String)values.elementAt(values.size() - 1);
    return value;
    catch (Exception e) {
    return null;
    // Returns the values of the named parameter as a String array, or null if
    // the parameter was not sent.
    public String[] getParameterValues(String name) {
    try {
    Vector values = (Vector)parameters.get(name);
    if (values == null || values.size() == 0) {
    return null;
    String[] valuesArray = new String[values.size()];
    values.copyInto(valuesArray);
    return valuesArray;
    catch (Exception e) {
    return null;
    // Returns the filesystem name of the specified file, or null if the
    // file was not included in the upload. A filesystem name is the name
    // specified by the user. It is also the name under which the file is
    // actually saved.
    public String getFilesystemName(String name) {
    try {
    UploadedFile file = (UploadedFile)files.get(name);
    return file.getFilesystemName(); // may be null
    catch (Exception e) {
    return null;
    // Returns the content type of the specified file (as supplied by the
    //client browser), or null if the file was not included in the upload.
    public String getContentType(String name) {
    try {
    UploadedFile file = (UploadedFile)files.get(name);
    return file.getContentType(); // may be null
    catch (Exception e) {
    return null;
    // Returns a File object for the specified file saved on the server's
    // filesystem, or null if the file was not included in the upload.
    public File getFile(String name) {
    try {
    UploadedFile file = (UploadedFile)files.get(name);
    return file.getFile(); // may be null
    catch (Exception e) {
    return null;
    // method that actually parses the request.
    protected void readRequest() throws IOException {
    // Check the content length to prevent denial of service attacks
    int length = req.getContentLength();
    if (length > maxSize) {
    throw new IOException("Posted content length of " + length +
    " exceeds limit of " + maxSize);
    // Check the content type to make sure it's "multipart/form-data"
    // Access header two ways to work around WebSphere oddities
    String type = null;
    String type1 = req.getHeader("Content-Type");
    String type2 = req.getContentType();
    // If one value is null, choose the other value
    if (type1 == null && type2 != null) {
    type = type2;
    else if (type2 == null && type1 != null) {
    type = type1;
    // If neither value is null, choose the longer value
    else if (type1 != null && type2 != null) {
    type = (type1.length() > type2.length() ? type1 : type2);
    if (type == null ||
    !type.toLowerCase().startsWith("multipart/form-data")) {
    throw new IOException("Posted content type isn't multipart/form-data");
    // Get the boundary string; it's included in the content type.
    // Should look something like "------------------------12012133613061"
    String boundary = extractBoundary(type);
    if (boundary == null) {
    throw new IOException("Separation boundary was not specified");
    // Construct the special input stream we'll read from
    MultipartInputStreamHandler in =
    new MultipartInputStreamHandler(req.getInputStream(), length);
    // Read the first line, should be the first boundary
    String line = in.readLine();
    if (line == null) {
    throw new IOException("Corrupt form data: premature ending");
    // Verify that the line is the boundary
    if (!line.startsWith(boundary)) {
    throw new IOException("Corrupt form data: no leading boundary");
    // Now that we're just beyond the first boundary, loop over each part
    boolean done = false;
    while (!done) {
    done = readNextPart(in, boundary);
    // A utility method that reads an individual part. Dispatches to
    // readParameter() and readAndSaveFile() to do the actual work. A
    // subclass can override this method for a better optimized or
    // differently behaved implementation.
    protected boolean readNextPart(MultipartInputStreamHandler in,
    String boundary) throws IOException {
    // Read the first line, should look like this:
    // content-disposition: form-data; name="field1"; filename="file1.txt"
    String line = in.readLine();
    if (line == null) {
    // No parts left, we're done
    return true;
    else if (line.length() == 0) {
    // IE4 on Mac sends an empty line at the end; treat that as the end.
    // Thanks to Daniel Lemire and Henri Tourigny for this fix.
    return true;
    // Parse the content-disposition line
    String[] dispInfo = extractDispositionInfo(line);
    String disposition = dispInfo[0];
    String name = dispInfo[1];
    String filename = dispInfo[2];
    // Now onto the next line. This will either be empty
    // or contain a Content-Type and then an empty line.
    line = in.readLine();
    if (line == null) {
    // No parts left, we're done
    return true;
    // Get the content type, or null if none specified
    String contentType = extractContentType(line);
    if (contentType != null) {
    // Eat the empty line
    line = in.readLine();
    if (line == null || line.length() > 0) {  // line should be empty
    throw new
    IOException("Malformed line after content type: " + line);
    else {
    // Assume a default content type
    contentType = "application/octet-stream";
    // Now, finally, we read the content (end after reading the boundary)
    if (filename == null) {
    // This is a parameter, add it to the vector of values
    String value = readParameter(in, boundary);
    if (value.equals("")) {
    value = null; // treat empty strings like nulls
    Vector existingValues = (Vector)parameters.get(name);
    if (existingValues == null) {
    existingValues = new Vector();
    parameters.put(name, existingValues);
    existingValues.addElement(value);
    else {
    // This is a file
    readAndSaveFile(in, boundary, filename, contentType);
    if (filename.equals(NO_FILE)) {
    files.put(name, new UploadedFile(null, null, null));
    else {
    files.put(name,
    new UploadedFile(dir.toString(), filename, contentType));
    return false; // there's more to read
    // A utility method that reads a single part of the multipart request
    // that represents a parameter. A subclass can override this method
    // for a better optimized or differently behaved implementation.
    protected String readParameter(MultipartInputStreamHandler in,
    String boundary) throws IOException {
    StringBuffer sbuf = new StringBuffer();
    String line;
    while ((line = in.readLine()) != null) {
    if (line.startsWith(boundary)) break;
    sbuf.append(line + "\r\n"); // add the \r\n in case there are many lines
    if (sbuf.length() == 0) {
    return null; // nothing read
    sbuf.setLength(sbuf.length() - 2); // cut off the last line's \r\n
    return sbuf.toString(); // no URL decoding needed
    // A utility method that reads a single part of the multipart request
    // that represents a file, and saves the file to the given directory.
    // A subclass can override this method for a better optimized or
    // differently behaved implementation.
    protected void readAndSaveFile(MultipartInputStreamHandler in,
    String boundary,
    String filename,
    String contentType) throws IOException {
    OutputStream out = null;
    // A filename of NO_FILE means no file was sent, so just read to the
    // next boundary and ignore the empty contents
    if (filename.equals(NO_FILE)) {
    out = new ByteArrayOutputStream(); // write to nowhere
    // A MacBinary file goes through a decoder
    else if (contentType.equals("application/x-macbinary")){
    File f = new File(dir + File.separator + filename);
    out = new MacBinaryDecoderOutputStream(
    new BufferedOutputStream(
    new FileOutputStream(f), 8 * 1024));
    // A real file's contents are written to disk
    else {
    File f = new File(dir + File.separator + filename);
    out = new BufferedOutputStream(new FileOutputStream(f), 8 * 1024);
    byte[] bbuf = new byte[100 * 1024]; // 100K
    int result;
    String line;
    // ServletInputStream.readLine()
    // adds a \r\n to the end of the last line.
    // Since we want a byte-for-byte transfer, we have to cut those chars.
    boolean rnflag = false;
    while ((result = in.readLine(bbuf, 0, bbuf.length)) != -1) {
    // Check for boundary
    if (result > 2 && bbuf[0] == '-' && bbuf[1] == '-') { // quick pre-check
    line = new String(bbuf, 0, result, "ISO-8859-1");
    if (line.startsWith(boundary)) break;
    // Are we supposed to write \r\n for the last iteration?
    if (rnflag) {
    out.write('\r'); out.write('\n');
    rnflag = false;
    // Write the buffer, postpone any ending \r\n
    if (result >= 2 &&
    bbuf[result - 2] == '\r' &&
    bbuf[result - 1] == '\n') {
    out.write(bbuf, 0, result - 2); // skip the last 2 chars
    rnflag = true; // make a note to write them on the next iteration
    else {
    out.write(bbuf, 0, result);
    out.flush();
    out.close();
    // Extracts and returns the boundary token from a line.
    private String extractBoundary(String line) {
    // Use lastIndexOf() because IE 4.01 on Win98 has been known to send the
    // "boundary=" string multiple times. Thanks to David Wall for this fix.
    int index = line.lastIndexOf("boundary=");
    if (index == -1) {
    return null;
    String boundary = line.substring(index + 9); // 9 for "boundary="
    // The real boundary is always preceeded by an extra "--"
    boundary = "--" + boundary;
    return boundary;
    // Extracts and returns disposition info from a line, as a String array
    // with elements: disposition, name, filename. Throws an IOException
    // if the line is malformatted.
    private String[] extractDispositionInfo(String line) throws IOException {
    // Return the line's data as an array: disposition, name, filename
    String[] retval = new String[3];
    // Convert the line to a lowercase string without the ending \r\n
    // Keep the original line for error messages and for variable names.
    String origline = line;
    line = origline.toLowerCase();
    // Get the content disposition, should be "form-data"
    int start = line.indexOf("content-disposition: ");
    int end = line.indexOf(";");
    if (start == -1 || end == -1) {
    throw new IOException("Content disposition corrupt: " + origline);
    String disposition = line.substring(start + 21, end);
    if (!disposition.equals("form-data")) {
    throw new IOException("Invalid content disposition: " + disposition);
    // Get the field name
    start = line.indexOf("name=\"", end); // start at last semicolon
    end = line.indexOf("\"", start + 7); // skip name=\"
    if (start == -1 || end == -1) {
    throw new IOException("Content disposition corrupt: " + origline);
    String name = origline.substring(start + 6, end);
    // Get the filename, if given
    String filename = null;
    start = line.indexOf("filename=\"", end + 2); // start after name
    end = line.indexOf("\"", start + 10); // skip filename=\"
    if (start != -1 && end != -1) {                // note the !=
    filename = origline.substring(start + 10, end);
    // The filename may contain a full path. Cut to just the filename.
    int slash =
    Math.max(filename.lastIndexOf('/'), filename.lastIndexOf('\\'));
    if (slash > -1) {
    filename = filename.substring(slash + 1); // past last slash
    if (filename.equals("")) filename = NO_FILE; // sanity check
    // Return a String array: disposition, name, filename
    retval[0] = disposition;
    retval[1] = name;
    retval[2] = filename;
    return retval;
    // Extracts and returns the content type from a line, or null if the
    // line was empty. Throws an IOException if the line is malformatted.
    private String extractContentType(String line) throws IOException {
    String contentType = null;
    // Convert the line to a lowercase string
    String origline = line;
    line = origline.toLowerCase();
    // Get the content type, if any
    if (line.startsWith("content-type")) {
    int start = line.indexOf(" ");
    if (start == -1) {
    throw new IOException("Content type corrupt: " + origline);
    contentType = line.substring(start + 1);
    else if (line.length() != 0) {  // no content type, so should be empty
    throw new IOException("Malformed line after disposition: " + origline);
    return contentType;
    // A class to hold information about an uploaded file.
    class UploadedFile {
    private String dir;
    private String filename;
    private String type;
    UploadedFile(String dir, String filename, String type) {
    this.dir = dir;
    this.filename = filename;
    this.type = type;
    public String getContentType() {
    return type;
    public String getFilesystemName() {
    return filename;
    public File getFile() {
    if (dir == null || filename == null) {
    return null;
    else {
    return new File(dir + File.separator + filename);
    // A class to aid in reading multipart/form-data from a ServletInputStream.
    // It keeps track of how many bytes have been read and detects when the
    // Content-Length limit has been reached.
    class MultipartInputStreamHandler {
    ServletInputStream in;
    int totalExpected;
    int totalRead = 0;
    byte[] buf = new byte[8 * 1024];
    public MultipartInputStreamHandler(ServletInputStream in,
    int totalExpected) {
    this.in = in;
    this.totalExpected = totalExpected;
    // Reads the next line of input. Returns null to indicate the end
    // of stream.
    public String readLine() throws IOException {
    StringBuffer sbuf = new StringBuffer();
    int result;
    String line;
    do {
    result = this.readLine(buf, 0, buf.length); // this.readLine() does +=
    if (result != -1) {
    sbuf.append(new String(buf, 0, result, "ISO-8859-1"));
    } while (result == buf.length); // loop only if the buffer was filled
    if (sbuf.length() == 0) {
    return null; // nothing read, must be at the end of stream
    sbuf.setLength(sbuf.length() - 2); // cut off the trailing \r\n
    return sbuf.toString();
    // A pass-through to ServletInputStream.readLine() that keeps track
    // of how many bytes have been read and stops reading when the
    // Content-Length limit has been reached.
    public int readLine(byte b[], int off, int len) throws IOException {
    if (totalRead >= totalExpected) {
    return -1;
    else {
    if (len > (totalExpected - totalRead)) {
    len = totalExpected - totalRead; // keep from reading off end
    int result = in.readLine(b, off, len);
    if (result > 0) {
    totalRead += result;
    return result;
    // Class to filters MacBinary files to normal files on the fly
    // Optimized for speed more than readability
    class MacBinaryDecoderOutputStream extends FilterOutputStream {
    int bytesFiltered = 0;
    int dataForkLength = 0;
    public MacBinaryDecoderOutputStream(OutputStream out) {
    super(out);
    public void write(int b) throws IOException {
    // Bytes 83 through 86 are a long representing the data fork length
    // Check <= 86 first to short circuit early in the common case
    if (bytesFiltered <= 86 && bytesFiltered >= 83) {
    int leftShift = (86 - bytesFiltered) * 8;
    dataForkLength = dataForkLength | (b & 0xff) << leftShift;
    // Bytes 128 up to (128 + dataForkLength - 1) are the data fork
    else if (bytesFiltered < (128 + dataForkLength) && bytesFiltered >= 128) {
    out.write(b);
    bytesFiltered++;
    public void write(byte b[]) throws IOException {
    write(b, 0, b.length);
    public void write(byte b[], int off, int len) throws IOException {
    // If the write is for content past the end of the data fork, ignore
    if (bytesFiltered >= (128 + dataForkLength)) {
    bytesFiltered += len;
    // If the write is entirely within the data fork, write it directly
    else if (bytesFiltered >= 128 &&
    (bytesFiltered + len) <= (128 + dataForkLength)) {
    out.write(b, off, len);
    bytesFiltered += len;
    // Otherwise, do the write a byte at a time to get the logic above
    else {
    for (int i = 0 ; i < len ; i++) {
    write(b[off + i]);

    I am also need to rename a file and extension while uploadinf the file to the server. The oreilly example seems only save as the same file name and ext. I wonder if you have the ability chANGE OIT OR NOT. pLEASE LET ME KNOW
    thanks
    kansen

  • Powershell to rename file based on output

    Good Afternoon
    I was wondering if someone could assist with the below
    1. We currently have a system in place whereby a document is scanned onto the system as an image and this is saved in a central location folder
    2. I then run tesseract within powershell on this location folder, which is a program that can extract the image to txt file and this converts the image to a txt file and saves in the same location with the same name
    3. What i would like to do is for powershell to then search the extracted txt file and look for a particular regexpression (which i have) and to then rename the original file from point 1 to the output
    Is the above possible at all
    This is what i have so far, what this seems to do is look in my ocr folder and run tesseract and the output txt files end up in the same folder
    $TargetFolder1 = “c:\ocr\test\file.txt”
    $regex = '[0-9]{5,6}[\.][0-9]{0,1}'
    $result = out-file ("c:\OCR\Match\""imtest" + ".txt")
    select-string -Path $Targetfolder1 -list -Pattern $regex | % { $_.Matches } | % { $_.Value } > $_result
    cd "C:\Program Files (x86)\Tesseract-OCR"
    Apologies of it seems confusing
    Barrie

    Hi
    Many thanks for the info so far, much appreciated
    I have read around on the Microsoft Powershell learning site but becoming slightly confused with some more piping
    I previously mentioned that the tesseract program converts the ocr scanned tif file into a text file - Is it possible instead to have this output to a variable of some sort and then for my reg expression carry out the search in the variable and
    then rename the tif file based on the result of the regexpression
    Previously i have ran tesseract on a tif file via powershell which in turn produces a text file of the document in the file location
    I think it would be best if i ran tesseract on the tif file, then for powershell to export the results somewhere and the reg expression query can be run and the final result will rename the original tif file with the output of the reg expression
    Hope this makes sense and many thanks for help so far
    Regards
    Barrie

  • IPhoto Questions (including rotating movie & save locations)

    I've owned my new Macbook Pro for a little over a month now. Prior to this I have been using Linux (Red Hat, SuSE, Ubuntu, etc...) on my primary computer and MS Windows for many, many years. I am very used to the way Linux and Windows handle files including imported photos. Prior to my Macbook purchase, I was managing my iPhone and iPad with Windows 7. Please pardon my Mac OS X ignorance. I am new to this.
    Here's my hardware:
    Macbook Pro 15" Retina 512gb (mid 2014) with OS X 10.10.1
    iPhone 5s (16gb)
    iPad 4 retina (64gb)
    Now the questions... When I import photos from my iPad or iPhone into iPhoto, the photo's do not go into the "Pictures" directory unlike Windows. I did some research and apparently iPhoto stores your photos in a database similar to the way iTunes works with music. However, unlike iTunes, you cannot browse the .jpg's and .mov's in the finder, you have to open them in iPhoto to see them. This creates a problem for me in that I can't back up my photos manually anymore to an external hard drive. I have to rely solely on Time Machine. I don't like that. Also, I'd just like to be able to browse my photos in finder. I want access to the .jpg's and .mov files so that I can copy them to USB thumb drives, etc... Is there a way to import your photos from the iPhone or iPad into the "Pictures" folder on my Macbook, then into a date sub folder similar to the way Windows imports photos? This would be preferable for me because I want access to the original files in finder, not just through iPhoto. If there is an "open in finder" option in iPhoto, obviously the photos are stored in folders on the Macbook. Why can't you just browse them from finder without using iPhoto? iTunes lets you do this. Is there a setting in iPhoto that I am missing that will allow this? If not there should be one similar to the iTunes "keep iTunes media folder organized" option.
    Also, when I have to rotate a movie that is located in the iPhoto library, I know that I can click "open in finder" from iPhoto and open the .mov in Quicktime to rotate the movie. However, when saving (there's no save option, you have to close and are prompted to export) there is no option to save in the original location and rewrite the movie in iPhoto. The only option is to store in one of the browsable file folders (Movies, Pictures, Documents, etc...). Consequently, when opening iPhoto, the movie file remains in the original rotation, unchanged. How do I have Quicktime save to the original location of the movie in the iPhoto library? You can not open iPhoto Library.photolibrary from within Quicktime and browse to the folder containing the original movie. This is mind boggling to me. I suppose I could delete the original movie in iPhoto and import the rotated movie into iPhoto, but this seems like a huge waste of steps, time and is really inefficient.
    I don't like not having control over my photos. I'd like to be able to view all of them in my finder. Am I missing a preferences setting or something? Any help would be greatly appreciated.

    I don't like not having control over my photos. I'd like to be able to view all of them in my finder.
    You have far more control over your Photos with iPhoto than with the Finder. But you can simply use the Finder or any other app to manage your photos, iPhoto is not compulsory in any way. If you are going to use iPhoto then there is a conceptual leap to make, and then it begins to make sense.
    That leap is this: that Jpeg is not your Photo. That .doc file is not your novel. That .mp3 is not the song. In each case, these files are containers for the data - with characteristics attuned to the nature of the data, sure - but your data is the photo, the novel, the song. Or put another way, they're the shoebox, your data is the shoes.
    iPhoto is about the Photo and not the file. If you want to manage files by all means do, and best to use a file manager. iPhoto is for managing Photos. The best analogy I can come up with is the Contacts.app. (and like all analogies, it's limited but here goes.) The Contacts.app is a central store and repository for anything to do with your address book, emails, phone numbers. Somewhere on the HD is a file or files with all this data, but you never go there. You either use the Contacts.app or any of the many hooks built-in to the OS to access, edit, share and manipulate this data.
    Now try the same with iPhoto: iPhoto is a central store and repository for anything to do with your photos. Somewhere on the HD is a file or files with all this data, but you never go there. You either use iPhoto or any of the many hooks built-in to the OS to access, edit, share and manipulate this data. So, iPhoto replaces the file manager for anything to do with your photos, because it's about the photos and not the files.
    Coming from Windows and Linux, especially, this level of abstraction can be confusing, but that's what it is. Added to this is the level of virtualisation used in iPhoto - all edits are virtual until you export - the non-destructive editing feature can also be confusing. But that's why iPhoto can't be navigated via the Finder. Comparing it with iTunes, which has no editing, is not comparing like with like. iPhoto will always preserve your original data - the photo as shot.
    To specifics:
    For help accessing your photos in iPhoto see this user tip:
    https://discussions.apple.com/docs/DOC-4491
    This User Tip
    https://discussions.apple.com/docs/DOC-4921
    has details of the options in the Export dialogue.
    This creates a problem for me in that I can't back up my photos manually anymore to an external hard drive.
    Of course you can. Simply Export them. File -> Export. Now you can choose exactly what to export: the original, an edited version, if different qualities and different formats. But again, simply backing up a version of the photos is not really backing up your work, just the raw data. So you need to back up the Library as well.
    have to rely solely on Time Machine. I don't like that.
    No you don't.
    Most Simple Back Up:
    Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
    Slightly more complex: Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically.
    Example of such apps: Chronosync - but there are many others. Search on MacUpdate or the App Store
    Is there a way to import your photos from the iPhone or iPad into the "Pictures" folder on my Macbook, then into a date sub folder similar to the way Windows imports photos?
    Two ways:
    1, With iPhoto you can run a Referenced Library. But I cannot urge you enough not to do this. iPhoto does not have the tools to manage this and you're only strong up grief for further down the road. It's unnecessary and only makes more work for exactly zero advantage.
    For more on iPhoto and file management see this User Tip:
    https://discussions.apple.com/docs/DOC-6361
    2. Use some other system for managing your photos. Image Capture (in the Applications Folder) will get your images from your camera/phone/whatever and put them wherever you like. Just don't use iPhoto.
    However, when saving (there's no save option, you have to close and are prompted to export) there is no option to save in the original location and rewrite the movie in iPhoto.
    Again, this has got to do with non-destructive  processing and that's why you're better importing movies to iMovie and processing them there and then exporting them to the finder, and only when you've finished them, importing them to iPhoto. (Or just not shooting video in portrait).

  • How can I get iTUNES library to display renamed files and folders (renamed with Windows Explorer)?

    How can I get iTunes library to display the new names and organisation of tracks and albums (ie files and folders) that I have renamed and reorganised (using Windows Explorer) having previously imported them using iTunes?
    (Even when I relocate "lost" tracks in iTunes (using the drop down menu facility to view in Windows explorer), although iTunes will then play the track, and knows where to find it, it refuses to display the track with its correct (new) name, or show it the correct (new) album.  That means I have lots of things called "Untitled" and "Track 01" etc, all of which have actually been renamed, but iTunes does not seem to have the capability to recognise the changes and update its library listing.  Another example - a Tchaikovsky CD with 3 major works in 13 tracks insists on displaying in iTunes as 13 tracks in one album, despite the fact that I have reorganised the tracks into 3 albums - two being Swan Lake and The Nutcracker - and renamed the individual tracks to a more useable format.)

    Thanks for your replies ckuan
    I agree with Tgod that your first solution does not work.  It appears unpredictable whether the old or new file names are listed when you drag the folders into iTunes from Windows Explorer.  The folder structure is completely missing.  I reckon if you have to muck around spending days/weeks/months finding out how to fix links to a secret meta-file (obviously designed by some deep-cover microsoft worm working in the Apple!), then it's pretty obvious that almost any alternate way of doing this would be better.   Bye bye iTunes!!
    Incidentally, I tried several other things that (if the software was designed intuitively) should work, but give disastrous results:
    1) when deleting the library listing in iTunes, it gives you two options - one is to remove the listings to the Recycler.  Be aware that IF you select that option, it removes not only your library listing, but also your ACTUAL MUSIC FILES to the Recycler.  Moreover, it does NOT remove the insidious secret meta-file that is what apparently keeps rewriting old names over your carefully renamed file names, and keeps totally ignoring your carefully designed folder (album) structure.  OK - not a complete disaster, as I realised and went hunting through the chaos in the Recycler to recover all my files.  No thanks to the genius who designed this brilliant feature!
    2) after deleting the library listing in iTunes, I attempted to import just the folders that I wanted.  iTunes refused to allow me to do that, and proceeded to try to import every frigging music file it could find on my whole hard drive, in apparently random fashion into the library.  Whoever thought up that doozy either never ever tried to use or market test it, or has modified their mind rather too many times with artificial substances so their brain is like muesli chop suey.
    3) oh why go on, it's too depressing ...

  • Rename File

    Greetings,
    Is it possible to rename a file while it is open in Photoshop? I use an action when closing/saving that saves the file in 3 different sizes/formats and it would be great if I could name the file just prior to saving.
    Thanks
    David

    Your goung about it the hard way. Do this instead. Create a simple action or actions that process the image the way or ways you want them processed. The actions should not resize or save image they should just process the image the way you want them processed. Once you have these actions. Download and install the Image Processor Pro plug-in script into your Photoshop version CS5, CS6, CC. from Russell Browns web site.  Then use menu File>Automate>Image Processor Pro.  Set the Image Processor Pro dialog to process your image files and save all the output files you want with the sizes and names you want.  Have the Image process include you action or actions in its process.

Maybe you are looking for