Glitch while renaming files

Hi, I found a glitch in Snow Leopard when I renaming files.
The text area where to type the new name is not placed in the right position.
This error happens in a folder, but if I open other folders it doesn't come out.

I have been having problem as well. At first I thought I must be accidentally brushing the touchpad, but there is definitely some other reason for it.
As sort of a workaround, you can edit file names by using Command-I to view find info and change it in the box that pops up. If you have to rename a bunch of files, use Command-Option-I which brings up a box that displays the relevant info for whichever file you happen to select.

Similar Messages

  • Finder bug while renaming files

    Has anyone seen the below behavior?
    I've noticed that when I try to rename a file by hitting the ENTER key - the file name goes into "edit mode". Occasionally, it will randomly exit this "edit mode" before I'm finished leaving my file name change abruptly committed while I'm only partially done.
    This behavior is easy to reproduce on my laptop but not in any reliable steps (meaning that if I rename 20 files in this manner, I expect to see this strange behavior about 50% of the time - but without any apparent rhyme or reason). In fact, if I enter "edit mode" like above (by hitting the ENTER key) and then don't type anything at all - about 1/2 the time the Finder will just exit the edit mode all by itself anyway.
    It's annoying but honestly I'm more curious about why this would happen than anything else.

    I have been having problem as well. At first I thought I must be accidentally brushing the touchpad, but there is definitely some other reason for it.
    As sort of a workaround, you can edit file names by using Command-I to view find info and change it in the box that pops up. If you have to rename a bunch of files, use Command-Option-I which brings up a box that displays the relevant info for whichever file you happen to select.

  • Rename Files while uploading, having special characters in File Name.

    Hello Forum,
    In our SharePoint environment, we are having many document library. Our users regularly uploads files to the documents library. As SharePoint doesn't allow to use "&"  character in file name, it'll throw an exception regarding the file
    name.
    Now what I needed is :
    Is there any way to remove "&" character while uploading files? Can we replace "&" with any other character while uploading files.
    If is there any paid solution available, leave comment.
    Thanks in Advance.

    You have to change the folder/file names before hand then upload them to Sharepoint.
    here is the script which will scan the files/folder and find the special charaters and fix for you.
    http://get-spscripts.com/2011/11/use-powershell-to-check-for-illegal.html
    Courtesy :Waqas
    Sarwar(MCSE 2013)
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • 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

  • Shell script for moving and renaming files

    I'm not so familiar with shell scripts. I have created some simple scripts for various tasks but now I hit something I can't handle myself.
    My server receives every night a logfile from another server. This file I need to rename and move to another location. Problem is that a simple mv with new filename isn't enough, I need to insert date in filename. Format for date should be ddmmyy. Also the name of incoming file changes every night. The output always starts with same letters, let's say "log", and the date is used to identify files.
    For example I receive a file /Input/filename.log and I need to move the file to the folder /Output with name log130308.txt.
    Any tips how to insert the date as part of of filename while renaming or moving the file? I prefer shell script as I'll use launchd for scheduling the script.

    Hi again,
    so far I've constructed this:
    cd /input
    for file in `ls *log`
    do
    echo "Copying " $file
    cp $file /output/log.$file.`date +%d%m%y`
    done
    Quite there. I'm cding to directory, i'll focus later how to set some environmental parameters.
    Problem with zipping is that I don't know exact logfiles names. Each day there's a new name. So zip -q filename.zip filename.log isn't quite enough and it's impossible to use wildcards. The switch -q and checksums were welcome suggestions.
    Thanks again,
    Juha
    Message was edited by: J.Otava

  • Batch rename files preserving the original file name in metadata

    How can I batch rename files while preserving the original file name in metadata? (Don't want the old file name as part of the new file name)
    (Adobe CS Bridge can do this with some success, but I don't want to be dependant on this software. Results are inconsistent.)

    With a simple terminal script. More details needed, though.

  • I have difficulty pasting text into the file name field(prefix only) while saving files.

    OS: WinXP sp3
    FF: 3.6.3
    I have difficulty pasting text into the file name field (prefix only) while saving files. example: File name is Pic123.jpg and I want to rename it ABC123.jpg and I have ABC loaded into the WinXPsp3 clipboard. When I highlight\right-click\delete "Pic" then attempt to paste the ABC, I get either no reaction, or upon multiple paste attempts, the ABC is appended to the end of the file, after the extension, as "Pic123.jpgABC". If I delete this unwanted suffix, or repeat the process several times, eventually I can delete the unwanted portion of the prefix and paste the desired text. Sometimes it works fine first try, but mostly it takes several tries. I'm using Firefox 3.6.3 but the problem existed in whatever previous version I had too. This issue only occurs when using the delete/paste; I can always manually change the name by typing. Thank you for your help.

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    A possible cause is that the server sends a wrong response header.
    The server may not comply to RFC 5987 and sends a wrong Content-Disposition:attachment; filename header.
    * https://developer.mozilla.org/en/Firefox_8_for_developers#Network

  • Possible: renaming files - folder names as variables.

    Here's a bit of background - I have a rather extensive MP3 collection (all legal - I work for an independent music magazine in my spare time) - it's approx 7,000 files big now.
    I have them all stored in folders as follows:
    c:\SAMag\MP3's\Albums (and here comes the tricky bit...)
    EITHER
    \Artist Name Here - Album Title\<.MP3 files here> (No artist names contain a '-' so this is the seperator)
    OR
    \Artists Name Here\Albums Title One\<.MP3 files here>
    \Artists Name Here\Albums Title Two\<.MP3 files here>
    \Artists Name Here\Albums Title Three\<.MP3 files here> (Where there are more than one albums to an artist)
    Playing these files is a nightmare as they all have different naming conventions and odd ID tags. I want to remove all ID tags and rename them to have meaningful file names (so that WinAmp displays a decent, non-confusing, name).
    I would like:
    "<artist name> - <song title> (<album title> - <#>)"
    So, basically - is it possible to rename files in Java. Specifically: using the folder names that they are contained in as variables to put in this name?
    Thanks for any help people!

    Thanks for that.
    I'm pretty new to this whole Java thing (even though
    I've been attempting to do it for a while!) so was
    wondering if you could point me in the right
    direction.
    That is exactly what I did though.
    Do you have the javadocs? If so then you look up java.io.File and read the methods in it.
    Here is the online link....
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html

  • Unable to rename file's

    i am trying to rename files in a folder nine
    files name are taken from the text file dnine.txt
    were for every occurance of a number in the filename
    i wrote this code it reaches the condition as marked bold but it isnt renaming the files
    plzz help
    import java.io.*;
    import java.util.*;
    class nan
    {     public static void main(String S[]) throws IOException
         Scanner track = new Scanner(new File("dnine.txt"));
         String [] Sme;
         Sme=new String[30];
         int i=0;
        while (track.hasNextLine())
        {Sme=track.nextLine();
    i++;      }
    File dir = new File("nine");
         String[] ch = dir.list();
         Arrays.sort(dir);
         String temp,temp2;
         File f[] = new File("nine").listFiles();
    for (i=0; i<ch.length; i++)     
    for (int j=0; j<Sme.length; j++)          
         {     temp2=""+j;
              temp="2X"+temp2+Sme[j]+".txt";
              *if(ch[i].indexOf(temp2)!=-1)          *
         {     File file = new File(ch[i]);
         File file2 = new File(temp);
         boolean success=f[i].renameTo(file2);
         System.out.println(ch[i]+success);

    Are you getting some sort of error? If so copy and paste the entire error message here and indicate on which line the error occurs.
    P.S. For the love of [insert deity], please make your code indentations consistent.

  • MobileMe problems! "Error occurred while publishing file..."

    Is anyone else getting an "error occurred while publishing file" message when they try to publish their iWeb sites to MobileMe? This happens all the time. As a result, all my red icons in the iWeb window remain red.
    I have tried renaming one of the site folders in MobileMe to see if that would eliminate the problem -- the program would think it was putting a new site on the Internet, instead of updating an existing one. That didn't work.
    If anyone has any advice, I'd be grateful.

    Me too. I went to the Apple store today as I have tried everything. Everything was fine until I updated to iLife 09. The advice I was given was to delete the site from my iDisk and then republish the whole thing - so as to start from fresh - but guess what?- same problem.
    I got this error message.
    Publish Error
    An error occurred while publishing file “/private/var/folders/ia/iabx77EFHCGu5JUdA-gS+++TI/TemporaryItems/com.apple.iWeb403_TEMP_255806071_2/sites/SukiHutchinson/Media/10 Left Bank Two - Theme From Vision On-1.mp3”. Try publishing again later.
    Any help would be appreciated - the mp3 file was fine before and it is not a DRM.
    Thanks

  • Rename files in Prelude?

    I don't see a way to rename video files in Prelude.  Coming from a still photo background I have always renamed files to a sensible name at the point of import.  If this can't be done in Prelude is there a suggestion on how to do this before prelude?  Kind of a prelude to using prelude?!?  For now I will continue to import and rename both still and vid files in Lightroom but would like to see this in Prelude.
    Thanks.

    Hi Mike
    Thanks for your response.
    Actually this is my first time working with the file based system. XDCAM. Usually the guys give me a single video file for footage and use it just it straight up.
    But since I was given an XDCAM I did a search and came across this post. So being my first time not sure how helpful I can be but let me give you my current workflow so maybe this can help answer your question above.
    I don't work with producers or directors I work with the end user or "viewer" as the case may be. So they are not technical and I can not tell them to get a copy of prelude and mark it up for me.
    What I do is take the raw footage and transcode to a web friendly size ( at this point quality is not the issue but cut points are) and load them up to my site for the client to review and give me notes according to timecode.
    Now when I load 20 of these up there and need to link them to my pages I like the files to be something I can understand. So I don't have to write down some sort of reference sheet so I can put the correct video on the correctly worded page.
    Of course I can easily batch transcode in media encoder but it is nice to be able to view the files as a group in prelude. (and would be nice to) rename each one while I am looking at it and know what clip it is. then transcode all in one step renanming the originals as an alias if you like in the project panel but would like my transcoded files to be renamed also for the upload.
    Not sure how it all works across the other programs yet, but I would like that if I can once on the initial ingest rename files to something I can easily understand what they are and be able to use that across the holy trinity Prelude, Premiere and After Effects. That would be most helpful

  • Bridge freezes when renaming files

    When I rename certain files or folders, Bridge freezes on this message:
    Updating the cache for items within the folder recursively...
    It doesn't happen with all files or folders, but I haven't been able to determine a pattern. I've also had issues with the previews associated with some files (I just get a gray box), so I'm thinking it's obviously a cache issue. I've cleared the cache multiple times with no success. Any ideas?
    I'm running OSX 10.6.7 (which brought with it lovely bug in PDFs with PostScript-flavored OpenType fonts), which might be an issue. I'm also using Dropbox 0.7.110, with three other users...there are a whole lot of files in Dropbox that constantly update, so I can see how that might affect it to.

    localproductions wrote:
    …wonder what else it could be...
    It could be Time Machine, Spotblight, Dropbox… especially the obnoxious, intrusive Time Machine.
    Chris Cox, a top Adobe engineer who has been writing Photoshop code for some 15 years, recently wrote:
    http://forums.adobe.com/message/3732888#3732888
    The players:   Photoshop, Bridge, Dropbox, Time Machine, Spotlight, Finder
    Photoshop
    creates a temp file, writes to the temp file, and renames the temp to
    replace the original file, plus gets stat on the files.
    Bridge only reads the file, and writes to it's database.
    Finder gets attributes on the file in the normal folders.
    Dropbox
    gets stat on the files from 2 different processes (Dropbox,
    dbfseventsd), even outside it's directory, even in temporary
    directories.
    Spotlight (mdworker, mds) gets stat, and reads the
    files, even in temporary directories, sometimes while the file is still
    being written.
    Time Machine (backupd) gets stats, reads the files, and sometimes sets attributes on the files, even in temporary directories.
    Photoshop, Bridge and Finder are acting as expected.
    While Dropbox and Spotlight are doing some excess work, they don't seem to cause file modifications.
    But
    Time Machine is doing things wrong and causing file modifications, plus
    would fit with the "have the file open a long time" symptom.
    and
    on my own system I've confirmed that Dropbox and dbfseventsd will get stats on files outside the Dropbox folder.
    Dropbox has some bugs to fix.
    Wo Tai Lao Le
    我太老了

  • Rename files using text or excel file

    I am trying to find out how to rename files on my pc using the names stored in a text document
    eg. the file on the pc is called "C07_08.dat"
    the text file has the following line "3am Eternal         KLF         03:15 121 BMG         C07.08"
    i want to change the name of the file "C07_08.dat" to "3am Eternal.mpeg"
    What I would like is a batch file or program or something that will see the text "C07.08" and find the corresponding file "C07_08.dat" and rename it "3am Eternal.mpeg"
    I have managed to create a excel document that has the information in four separate columns
    Column A has the name of the file I want to use (ie. 3am Eternal) Column B & C have unneeded information and Column D has the file reference (ie. C07.08)
    I was told that Python or Visual basic could do this so I downloaded them but I have no experience with this so im lost as to what to do, I have over 1800 of these files so doing it file by file will take quite a while.
    I have included a sample of the text file for reference if that helps
    3am Eternal KLF 03:15 121 BMG C07.08
    4 In The Morning Gwen Stefani 04:22 092 UMA HD1.10
    4 Minutes Madonna ft J Timberlake 04:04 113 WAR HE3.05
    5 6 7 8 Steps 03:24 000 BMG C48.03
    5678 Steps 03:23 140 MUS H16.02
    6 Of 1 Thing Craig David 03:15 116 WAR HE2.11
    60 MPH New Order 03:51 125 WAR N57.11
    7 Days Craig David 04:30 084 SHO N41.16
    7 Things Miley Cyrus 03:29 107 EMI HE7.09
    99 Luft Balloons Nena 03:58 095 WAR C27.10
    99 Times Kate Voegele 03:27 112 UMA HG6.07
    A Girl Like You Edwyn Collins 03:47 126 MDS R06.08
    A Little Bit Pandora 03:35 132 UMA H23.01
    A Little Less Conversation Elvis VS JXL 03:02 115 BMG H68.03
    A Matter Of Trust Billy Joel 04:00 110 SON C59.11
    A New Day Has Come Celine Dion 04:20 092 SON H65.20
    A Woman Like You Mondo Rock 04:03 169 MUS R06.01
    About You Now Sugababes 03:32 083 UMA HD5.08
    Absolutely Everybody Vanessa Amorosi 03:52 124 TRA H40.06
    Absolutely Fabulous Pet Shop Boys 03:45 132 EMI C15.02
    Accidentally In Love Counting Crows 03:08 138 UMA H94.05
    According To You Orianthi 03:18 066 UMA HG4.12
    Achy Breaky Heart Billy Ray Cyrus 03:55 122 SON K11.02

    Here are two VBScripts that will rename the files based on the text file example you provided. The script that reads a
    TEXT FILE requires each entry to be separated by
    ONE TAB  because it is the
    TAB
    that it uses to split each line into 4 parts (part1 - old file name, part2 and part3 - items you don’t need, part 4 - new file name). If there is more that one tab then the Split Function will not work properly.
    The second VBScript will read the
    EXCEL FILE row by row and use the values in Column A for the old file name and
    Column D for the new file name. This approach will work much better if you have an excel document setup like this.
    I used your example that you provided and it test fine for both approaches.
    'Read text file
    Dim objFSO, objFolder, inFile, strInLine, strOldFile, strNewFile
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'Select the folder
    Set objFolder = objFSO.GetFolder("C:\Scripts\MusicFiles")
    'Open Text File
    Set inFile = objFSO.OpenTextFile("C:\Scripts\MusicFiles.txt",1)
    Do Until inFile.AtEndOfStream
    'Read text file line by line and Split each line into 4 parts.
    strInLine = Split(inFile.ReadLine, vbTab)
    'Old File name
    strOldFile = strInLine(3)
    'new File name
    strNewFile = strInLine(0)
    'Loop through the files in the folder
    For Each File In objFolder.Files
    'If the file name matches the old file name above
    If File.Name = strOldFile & ".dat" Then
    'Replace it
    File.Name = strNewFile & ".mpeg"
    End If
    Next
    Loop
    'Close the text reader
    inFile.Close
    MsgBox "Done."
    'Read Excel file
    Dim objFSO, objExl, objFolder, objWorkbook, strOldFile, strNewFile, intRow
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objExl = CreateObject("Excel.Application")
    'Select the folder
    Set objFolder = objFSO.GetFolder("C:\Scripts\MusicFiles")
    'Open the Excel file
    Set objWorkbook = objExl.Workbooks.Open("C:\Scripts\MusicFiles.xls")
    'Start at row 1
    intRow = 1
    'Read each Row until the end
    Do Until objExl.Cells(intRow,1).Value = ""
    'Old file name is in column 4
    strOldFile = objExl.Cells(intRow, 4).Value
    'New file name is in column 1
    strNewFile = objExl.Cells(intRow, 1).Value
    'Loop through each file in the selected folder
    For Each File In objFolder.Files
    'If the file name matches the old file name above
    If File.Name = strOldFile & ".dat" Then
    'Replace it
    File.Name = strNewFile & ".mpeg"
    End If
    Next
    'Increment each row
    intRow = intRow + 1
    Loop
    'Close Excel
    objExl.Quit
    MsgBox "Done."
    v/r LikeToCode....Mark the best replies as answers.

  • Sedname - Batch rename files using sed

    Renaming files using sed is nothing new, but this script makes the process a little more friendly and adds a few features, including insertion of sequential numbers and a simulation mode.  The output of any find command can also be piped through sedname.
    sedname version 1.0.0
    Batch-renames files using a sed script
    Usage: sedname [OPTIONS] SEDSCRIPT FILE ...
    Usage: find [...] | sedname [OPTIONS] SEDSCRIPT
    Example: sedname 's/\(.*\)\.jpg/\1.jpeg/' *.jpg
    Example: find /mypics | sedname 's/\(.*\)\.jpg/\1.jpeg/'
    OPTIONS:
    --sim simulate only
    --dir rename directories too
    Use #D to insert a number with D digits forming a unique filename
    Example: sedname 's/thisname.*/thatname#3/' *
    ( changes thisname* to thatname001, thatname002, ... )
    Use #0 in replacement name to insert a number if needed
    Example: sedname 's/thisname.*/thatname#0/' *
    ( changes thisname* to thatname, thatname1, thatname2, ... )
    http://igurublog.wordpress.com/download … t-sedname/
    http://aur.archlinux.org/packages.php?ID=37707

    What does it have over zsh's zmv:
    # Remove illegal characters in a fat32 file system. Illegal characters are
    # / : ; * ? " < > |
    # NOTE: ``-Q'' and (D) is to include hidden files.
    $ unwanted='[:;*?\"<>|]'
    $ zmv -Q "(**/)(*$~unwanted*)(D)" '$1${2//$~unwanted/}'
    # Changing part of a filename (i. e. "file-hell.name" -> "file-heaven.name")
    $ zmv '(*)hell(*)' '${1}heaven${2}'
    # or
    $ zmv '*' '$f:s/hell/heaven/'
    # remove round bracket within filenames
    # i. e. foo-(bar).avi -> foo-bar.avi
    $ zmv '*' '${f//[()]/}'
    # serially all files (foo.foo > 1.foo, fnord.foo > 2.foo, ..)
    $ ls *
    1.c asd.foo bla.foo fnord.foo foo.fnord foo.foo
    $ c=1 zmv '*.foo' '$((c++)).foo'
    $ ls *
    1.c 1.foo 2.foo 3.foo 4.foo foo.fnord
    # Rename "file.with.many.dots.txt" by substituting dots (exept for the last
    # one!) with a space
    $ touch {1..20}-file.with.many.dots.txt
    $ zmv '(*.*)(.*)' '${1//./ }$2'
    # Remove the first 4 chars from a filename
    $ zmv -n '*' '$f[5,-1]' # NOTE: The "5" is NOT a mistake in writing!
    # Rename names of all files under the current Dir to lower case, but keep
    # dirnames as-is.
    $ zmv -Qv '(**/)(*)(.D)' '$1${(L)2}'
    # replace all 4th character, which is "1", with "2" and so on
    $ zmv '(???)1(???[1-4].txt)' '${1}2${2}'
    # Remove the first 15 characters from a string
    $ touch 111111111111111{a-z}
    $ zmv '*' '$f[16,-1]'
    # Replace spaces (any number of them) with a single dash in file names
    $ zmv -n '(**/)(* *)' '$1${2//( #-## #| ##)/-}'
    # or - with Bash
    $ find . -depth -name '* *' -exec bash -c '
    > shopt -s extglob
    > file=$1
    > dir=${file%/*}
    > name=${file##*/}
    > newname=${name//*([ -]) *([ -])/-}
    > mv -i -- "$file" "$Dir/$newname"' {} {} \;
    # Clean up file names and remove special characters
    $ zmv -n '(**/)(*)' '$1${2//[^A-Za-z0-9._]/_}'
    # Add *.py to a bunch of python scripts in a directory (some of them end
    # in *.py and give them all a proper extension
    $ zmv -n '(**/)(con*)(#qe,file $REPLY | grep "python script",)' '$1$2.py'
    # lowercase all extensions (i. e. *.JPG) incl. subfolders
    $ zmv '(**/)(*).(#i)jpg' '$1$2.jpg'
    # Or - without Zsh
    $ find Dir -name '*.[jJ][pP][gG]' -print | while read f
    > do
    > case $f in
    > *.jpg) ;
    > *) mv "$f" "${f%.*}.jpg" ;
    > esac
    > done
    # remove leading zeros from file extension
    $ ls
    filename.001 filename.003 filename.005 filename.007 filename.009
    filename.002 filename.004 filename.006 filename.008 filename.010
    $ zmv '(filename.)0##(?*)' '$1$2'
    $ ls
    filename.1 filename.10 filename.2 filename.3 filename.4 filename.5 ..
    # renumber files.
    $ ls *
    foo_10.jpg foo_2.jpg foo_3.jpg foo_4.jpg foo_5.jpg foo_6.jpg ..
    $ zmv -fQ 'foo_(<0->).jpg(.nOn)' 'foo_$(($1 + 1)).jpg'
    $ ls *
    foo_10.jpg foo_11.jpg foo_3.jpg foo_4.jpg foo_5.jpg ...
    # adding leading zeros to a filename (1.jpg -> 001.jpg, ..
    $ zmv '(<1->).jpg' '${(l:3::0:)1}.jpg'
    # See above, but now only files with a filename >= 30 chars
    $ c=1 zmv "${(l:30-4::?:)}*.foo" '$((c++)).foo'
    # Replace spaces in filenames with a underline
    $ zmv '* *' '$f:gs/ /_'
    # Change the suffix from *.sh to *.pl
    $ zmv -W '*.sh' '*.pl'
    # Add a "".txt" extension to all the files within ${HOME}
    # ``-.'' is to only rename regular files or symlinks to regular files,
    # ``D'' is to also rename hidden files (dotfiles))
    $ zmv -Q '/home/**/*(D-.)' '$f.txt'
    # Or to only rename files that don't have an extension:
    $ zmv -Q '/home/**/^?*.*(D-.)' '$f.txt'
    # Recursively change filenames with characters ? [ ] / = + < > ; : " , - *
    $ chars='[][?=+<>;",*-]'
    $ zmv '(**/)(*)' '$1${2//$~chars/%}'
    # Removing single quote from filenames (recursively)
    $ zmv -Q "(**/)(*'*)(D)" "\$1\${2//'/}"
    # When a new file arrives (named file.txt) rename all files in order to
    # get (e. g. file119.txt becomes file120.txt, file118.txt becomes
    # file119.txt and so on ending with file.txt becoming file1.txt
    $ zmv -fQ 'file([0-9]##).txt(On)' 'file$(($1 + 1)).txt'
    # lowercase/uppercase all files/directories
    $ zmv '(*)' '${(L)1}' # lowercase
    $ zmv '(*)' '${(U)1}' # uppercase
    # Remove the suffix *.c from all C-Files
    $ zmv '(*).c' '$1'
    # Uppercase only the first letter of all *.mp3 - files
    $ zmv '([a-z])(*).mp3' '${(C)1}$2.mp3'
    # Copy the target `README' in same directory as each `Makefile'
    $ zmv -C '(**/)Makefile' '${1}README'
    # Removing single quote from filenames (recursively)
    $ zmv -Q "(**/)(*'*)(D)" "\$1\${2//'/}"
    # Rename pic1.jpg, pic2.jpg, .. to pic0001.jpg, pic0002.jpg, ..
    $ zmv 'pic(*).jpg' 'pic${(l:4::0:)1}.jpg'
    $ zmv '(**/)pic(*).jpg' '$1/pic${(l:4::0:)2}.jpg' # recursively
    (from zsh-lovers)
    Edit: tried it now, and had to remove this silly block to make it let me use alternate delimiters:
    if [ "${sedscript:0:2}" != "s/" ]; then
    echo "Invalid sed script: $sedscript" > /dev/stderr
    exit 1
    fi
    Last edited by JohannesSM64 (2010-05-31 15:29:44)

  • Renaming files in a book

    Hi everyone,
    I need to rename files in a book, but from within the book. A Save as... won't update the cross refrences.
    I see an fcode for this (FCodes.KBD_BOOKRENAMEFILE), but I've been advised not to rely on these types of shortcuts.
    I don't see anything else documented in the Scripting Guide. Does anyone else have any other suggestions?
    Thanks so much!
    Heather A

    Just following up for anybody else who might need this in the future.
    My hangup was that pulling files from the book itself created Doc objects, not File objects (beginners mistake, you hate to see it). Anyway, here are some of the functions that I came up with to handle this task for anybody who needs it. Please be warned, this is quite literally my first ExtendScript project so this may not be the most efficient way to have done this (I'm always open to constructive criticism from those more experienced than myself). I know I went overkill with notes in the code, that was requested by colleagues who know less about code than I do so that if I were no longer employed for some reason another person could come in and understand exactly what the code was doing.
    function fileNameReplacer(FullArray, CodeBook, BookFile) {
        /*The fileNameReplacer steps through all of the files in the book looking for those who need to be renamed.
            The function first renames all of the files, and then cycles through each file's Crossreferences and updates the
            names to reflect name changes*/
        /*Local variables are created*/
        var FileName,
            BookName,
            FilePath,
            FullName,
            FileType,
            EncodedName,
            OldName,
            NewName,
            ThisFile,
            OpenFile,
            FileArray;
        FileArray = FullArray;
        /*Loops through all of the files in the book*/
        for (var i = 0, len = FileArray.length; i < len; i++) {
            /*Tests if the file is type 255 which would signify it is a folder or a group (These will not be renamed and would throw errors)*/
            if (FileArray[i][0].type == 255) {
                /*If the file is identified as a group or folder, it is removed from the Array with the "splice" command*/
                FileArray.splice(i, 1);
                /*The counters for this loop are then adjusted to reflect the new length of the "FileArray" variable*/
                i = i - 1;
                len = len - 1;
                /*Starts the next round of the loop (which is actually repeating the same loop but without the group or folder in the Array)*/
                continue;
            /*If the file being looked at is not a folder or group, it is assigned to the "ThisFile" variable*/
            ThisFile = FileArray[i][0];
            /*Checks the file to see if it's element catalog has values. If there are no values, it would mean that there is no data from which
                to develop the encoded name, and likely means the file is something like a cover page or table of contents which do not need encoding*/
            if (ThisFile.ElementCatalog.length !== 0) {
                /*If the element catalog has items in it, the name of the current file being examined is assigned to the "FullName" variable*/
                FullName = ThisFile.Name;
                /*The FullName is then split into an array at each backslash (Backslashes in JavaScrip have their own meaning, in order to
                    input a single backslash two must be used). The last item of the array is the file name which is assigned to the "FileName"
                    variable using the "pop" command*/
                FileName = FullName.split("\\").pop();
                /*The FileName is then split at the period, and the file extension with a leading period is assigned to the "FileType" variable.*/
                FileType = "." + FileName.split(".").pop();
                /*The file path without file name is assigned to the "FilePath" variable. This is done by identifying where in the "FullName" variable
                    the "FileName" begins, and then taking a substring of the "FullName" up to that point.*/
                FilePath = FullName.substr (0, (FullName.indexOf(FileName)));
                /*The new encoded file name is found by running the current file through the nameEncoder function along with the Abbreviation List
                    (Called "CodeBook" in this function). The value produced by the nameEncoder function is assigned to the "EncodedName" variable*/
                EncodedName = nameEncoder(ThisFile, CodeBook);
                /*The encoded name and original name are then assigned to locations 2 and 1 in the File array respetively*/
                FileArray[i][2] = FilePath + EncodedName + FileType;
                FileArray[i][1] = FullName;
                /*The old name and new name are compared to see if a change has actually occurred*/
                if (FileArray[i][1] === FileArray[i][2]) {
                    /*If no change has occured, the file is removed from the array using the "splice" command, since it will only slow down later processes.*/
                    FileArray.splice(i, 1);
                    /*The loop counters are updated to reflect the change in FileArray length*/
                    i = i - 1;
                    len = len - 1;
                    /*Starts the next round of the loop (which is actually repeating the same loop but with the file not requiring renaming removed)*/              
                    continue;
            } else {
                /*If the element catalog for the current file does not have any values it is removed from the "FileArray" using the "splice" command*/
                FileArray.splice(i, 1);
                /*The loop counters are updated to reflect the change in FileArray length*/
                i = i - 1;
                len = len - 1;
                /*Starts the next round of the loop (which is actually repeating the same loop but with the file lacking elements removed)*/
                continue;
        /*At this point the FileArray contains only files that can, and have been renamed; along with their current and new names*/
        /*Loops through all files in the FileArray*/
        for (var l = 0, lenA = FileArray.length; l < lenA; l++) {
            /*Assigns the current file, its old name, and its new name to the "ThisFile", "OldName", and "NewName" variables respectively*/
            ThisFile = FileArray[l][0];
            OldName = FileArray[l][1];
            NewName = FileArray[l][2];
            /*Opens the current file assigned to "ThisFile" as a File object. File objects allow for changes on the drive itself to be made, while
                changing the .Name attribute of a Doc object will not. This allows for the encoded names to be applied directly to the files themseves.*/
            OpenFile = File(ThisFile.Name);
            OpenFile.rename(NewName);
            /*Changes the file's label to the value of "NewName" and removes the file type (as the label does not show file type)*/
            ThisFile.Label = NewName.split(".").shift();
            /*Changes the PrintFileName value to the value of "NewName" with the file type changed to ".ps"*/
            ThisFile.PrintFileName = NewName.split(".").shift() + ".ps";
        /*Traverses all files in the books and renames the target the book is looking for. If this is not done, the book will still think the old names exist and will
            try to find them to no avail. "traverse" function sends each component in the book through another function,
              in this case the bookComponentRenamer, and supplies the second function with a parameter, FileArray here.*/
        traverse(BookFile, bookComponentRenamer, FileArray);
        xrefRenamer(FullArray, FileArray);
        /*Saves the book file with the updated component names*/
        BookFile.SimpleSave(BookFile.Name);
        /*When the book is closed, the BookFile variable will no longer function. Assigning the current books name to the "BookName" varibales will allow the book to be reopened*/
        BookName = BookFile.Name;
        /*All open files are closed*/
        closeAll();
        /*Curent book is reopened*/
        BookFile = openBook (BookName);
        /*All book files (now with updated names) are opened*/
        traverse(BookFile, openfile);
        /*Returns the updated book back to the location that originally called the fileNameReplacer function*/
        return BookFile;
    function bookComponentRenamer(Component, FileArray) {
        /*The bookComponentRenamer compares the current book component with names on the FileArray (these are files that have name changes.
            If a match is found, that compent's name is changed within the book itself. This ensures that the names the book file is looking for reflect the updated file names created by this program*/
        for (var i = 0, len = FileArray.length; i < len; i++) {
            if (Component.Name === FileArray[i][1]) {
                Component.Name = FileArray[i][2];
    function xrefRenamer(AllFiles, RenamedFiles) {
        var ThisFile,
            ThisXREF,
            NextXREF,
            OldName,
            NewName,
            XREFTest;
        for (var i = 0, len = AllFiles.length; i < len; i++) {
            /*Assigns the first cross reference in the current file to the "ThisXREF" variable*/
            ThisFile = AllFiles[i][0];
            ThisXREF = ThisFile.FirstXRefInDoc;
            /*Whether "ThisXREF" contains a valid cross reference (having a null value means the file has no cross references, or we have already
                looped through them all and can proceed to the next file in the FileArray)*/
            while (ThisXREF.XRefFile !== null) {
                /*Assigns the next cross reference in the file to the "NextXREF" variable*/
                NextXREF = ThisXREF.NextXRefInDoc;
                /*Loops through all of the files in the FileArray. This will let the current cross reference be compared to the files being renamed and see if
                    there are any matches*/
                for (var j = 0, lenA = RenamedFiles.length; j < lenA; j++) {
                        /*Assigns the old name and the new name of the file being compared to cross references to the "OldName" and "NewName" variables respectively*/
                        OldName = RenamedFiles[j][1];
                        NewName = RenamedFiles[j][2];
                        XREFTest = ThisXREF.XRefFile.indexOf(OldName);
                        /*Tests if the current cross reference being examined links to the current comparison file*/
                        if (0 <= XREFTest) {
                            /*If yes, the cross reference is updated with the new name*/
                            ThisXREF.XRefFile = ThisXREF.XRefFile.replace(OldName, NewName);
                            /*Ends the comparison loop for this cross reference as the correct replacement has been found*/
                            break;
                /*Assigns "ThisXREF" with the value of the "NextXREF" the comparison loop starts again*/
                ThisXREF = NextXREF;
            ThisFile.SimpleSave(ThisFile.Name);

Maybe you are looking for

  • IPhone 5 Apps won't open after New Years Eve

    I got a new iPhone 5 for Christmas.  Everything was working fine up until New Year's Eve.  On January 1st non of my Apps will open.  I've deleted them manually from the phone and reinstalled them from the App Store, powered phone off, put phone in ai

  • Invoice BUS2205 Workflow

    All- We are working on a SRM 5.0 (Classic Scenario Implementation). We have implemented the 2 step Invoice workflow along with other workflows. The business requirement is as follows: 1.) Requester creates invoice 2.)Special approver changes/Updates

  • R/3 not startup

    Dear sir actually i am installing a dialog instace ,and i have share a usr (folder) as a SAPMNT for the network ,that time problem arise , how resolve this problem SAP-R/3-Startup Program Starting at 2007/10/31  9:58:11 Startup Profile: "D:\usr\sap\B

  • PSE6 for the Mac and a Snow Leopard question.....

    Hi- I am beta testing Snow Leopard and would like to test my PSE6 app in Snow Leopard but I am having an issue with what I need to copy over from the working version in Leopard over to Snow Leopard. Just dragging the folder is not enough since I get

  • Convert Char to Packed type

    Hi, I have a character variable which holds the value for eg as '1,234.56' Now i need to pass this value to an import parameter in a Function moudle .(But this parameter is of packed type). Now how can i convert  a character variable to a packed type