Rename files in different subfolders

Hello,
I am looking for a script to do the following:
I have different files in various folders and subfolders that I wish to rename.
So I need a script to search for files in all folders and subfolders of my external drive and find all files ending in .doc.
Then I need each file to be renamed as "report.doc". (there is only one file per subfolder so there is no danger of having two files with the same name.)
Can someone show me how to do that? I found similar posts but it was not what I was looking for.
Thank you very much for your time.

This is an old document I have so some may no longer exist or work with Lion, but you can probably find utilities that will do this for you.  I use Renamer4Mac from back when it was free.
*Renaming Utilities*
NameChanger [http://www.mrrsoftware.com/MRRSoftware/NameChanger.html]
Renamer4Mac [http://renamer4mac.com/batch-rename-files-on-mac-osx.html] - now shareware but older versions may still be free.
psrenamer [http://www.powersurgepub.com/downloads.html#psrenamer] - Java based (=slightly slow) free utility.
Name Mangler [http://www.manytricks.com/namemangler/] - requires OS 10.5+, but File List [http://www.manytricks.com/download/filelist] is an older version for pre-10.5.
[http://www.publicspace.net/ABetterFinderRename/] - $20

Similar Messages

  • Rename files in multiple subfolders

    Hello,
    I am looking for a way to do the following:
    I have different files in various folders and subfolders that I wish to rename.
    So I need automator to search for files in all folders and subfolders of my external drive and find all files ending in .doc.
    Then I need each file to be renamed as "report.doc". (there is only one file per subfolder so there is no danger of having two files with the same name.)
    Can someone show me how to do that? I found similar posts but it was not what I was looking for. I've even posted a similar question to applescript discussions in case automator doesn't have this possibility.
    Thank you very much for your time.

    It can get very confusing for people helping when you post the same question in multiple forums.  I have already posted some suggestions in your other thread:
    https://discussions.apple.com/thread/3882697

  • Batch Rename Multiple files with different names

    Hi,
    Is there any way to batch rename multiple files with individual names? I.e
    IMG_123 changed to  RSP45AS
    IMG_124 changed to MOL157A
    IMG_125 changed to AGKH135
    IMG_126 changed to MNOLH13
    IMG_127 changed to ASFBLUG
    Etc.
    Are they any programs or scripts or plug ins that would do that job?
    Thanks

    HI there Onemorewave,
    It looks like there is a batch remname feature included in OS X 10.10 Yosimte if you are planing on updating. 
    Rename files, folders, and disks - Mac Help
    Rename multiple items
    Select the items, then Control-click one of them.
    In the shortcut menu, select Rename Items.
    In the pop-up menu below Rename Folder Items, choose to replace text in the names, add text to the names, or change the name format.
    Replace text: Enter the text you want to remove in the Find field, then enter the text you want to add in the “Replace with” field.
    Add text: Enter the text to you want to add in the field, then choose to add the text before or after the current name.
    Format: Choose a name format for the files, then choose to put the index, counter, or date before or after the name. Enter a name in the Custom Format field, then enter the number you want to start with.
    Click Rename.
    Note: To batch rename, you would want to choose the "Format" option.
    -Griff W

  • Where can I find a macro I can use in Project Properties to generate PDB files of different filenames each build?

    Found a better solution. The answer is given at the very bottom of this post.
    I'm looking for $(Random), %(Date), %(Time), or some %(Value) that I can put in the "Generate Program Database File" entry.
    Like "$(TargetDir)_%(CreateTime).pdb".
    But the problem is, %(CreateTime), %(ModifiedTime), and %(AccessTime) has colons in them, making them useless when putting them into the filenames.
    What other ways can I generate PDB files of different file names? Or, how do you modify %(CreateTime) so that I can remove the colons and just obtain the numeric values?

    Hi Tom_mail78101,
    It seems that there is no built-in macro for renaming the PDB files randomly.
    You could submit this feature request:
    http://visualstudio.uservoice.com/forums/121579-visual-studio
    The Visual Studio product team is listening to user voice there. You can send your ideas/suggestions there and people can vote.
    I agree with Viorel. The possible way to rename the PDB files is that you write your own script to rename the PDB file after building the project and put the script to Post-Build event in Build Event. As for whether this way can accomplish it, you can try
    to consult on: MSBuild
    forum like this thread: https://social.msdn.microsoft.com/Forums/vstudio/en-US/bcf39fd6-0e0c-4486-9438-7a724ded44de/postbuild-event-command?forum=msbuild
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • 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

  • Save file in different name

    How can I save the screenshot image in different names?
    Example:When button 1 is click save in screenshot1.jpg, then button 1 is click again save in screenshot2.jpg ......etc
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim bmpScreenshot As Bitmap = New Bitmap(Panel1.Width, Panel1.Height - 300, PixelFormat.Format32bppArgb)
    ' Create a graphics object from the bitmap
    Dim gfxScreenshot As Graphics = Graphics.FromImage(bmpScreenshot)
    ' Take screenshot of just the panel control
    gfxScreenshot.CopyFromScreen(Me.PointToScreen(Panel1.Location), New Point(0, 0), Panel1.Size, CopyPixelOperation.SourceCopy)
    ' Save the screenshot
    bmpScreenshot.Save("D:\screenshot.jpg", Imaging.ImageFormat.Jpeg)
    End Sub
    Thanks

    If you only want to number the images like ScreenShot_0000, ScreenShot_0001, and so on...  Then you can use a class scoped integer variable to number them like below.  Also, you can draw the panel directly to a Bitmap without using the CopyFromScreen
    method.
    Public Class Form1
    Private count As Integer = 0
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim bmp As New Bitmap(Panel1.Width, Panel1.Height)
    Panel1.DrawToBitmap(bmp, New Rectangle(Point.Empty, Panel1.Size))
    Dim fn As String = "ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
    Dim saveas As String = IO.Path.Combine("C:\TestFolder", fn)
    bmp.Save(saveas, Imaging.ImageFormat.Jpeg)
    count += 1
    End Sub
    End Class
     However, when you close your application and reopen it again it would start at ScreenShot_0000 again and would overwrite any images that are in that directory that have the same numbered names.  If you want it to automatically detect the last
    numbered file and start with the next number then you can use a While loop in the above code to avoid overwriting the existing images like this.
    Public Class Form1
    Private count As Integer = 0
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim bmp As New Bitmap(Panel1.Width, Panel1.Height)
    Panel1.DrawToBitmap(bmp, New Rectangle(Point.Empty, Panel1.Size))
    Dim fn As String = "ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
    Dim saveas As String = IO.Path.Combine("C:\TestFolder", fn)
    While IO.File.Exists(saveas)
    count += 1
    fn = "ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
    saveas = IO.Path.Combine("C:\TestFolder", fn)
    End While
    bmp.Save(saveas, Imaging.ImageFormat.Jpeg)
    count += 1
    End Sub
    End Class
    If you say it can`t be done then i`ll try it
    Hi IronRazerz,
    Thanks for your solution. I would like to ask you question about open files and rename files, I know that there are out of the question in this thread but the only way I can get the answer through your solution.
    My problem is when I open files "ScreenShot_0000.jpg" and then when I want to rename files the file will rename  "ScreenShot_0001" instant of "ScreenShot_0000.jpg".
    How can I suppose to open and rename files follow by sequence without interrupt?
    Below codes are my modified codes to open and rename files.
    Public Class Form1
    Private count As Integer = 0
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    'rename files
    Dim fn As String = "C:\Users\hwai\Desktop\Capture\ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
    Dim saveas As String = IO.Path.Combine("C:\Users\hwai\Desktop\Capture\", fn)
    My.Computer.FileSystem.RenameFile(saveas, "Rename_" & count.ToString.PadLeft(4, "0"c) & ".jpg")
    count += 1
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    'open files
    Dim fn As String = "C:\Users\hwai\Desktop\Capture\ScreenShot_" & count.ToString.PadLeft(4, "0"c) & ".jpg"
    Dim saveas As String = IO.Path.Combine("C:\Users\hwai\Desktop\Capture\", fn)
    Dim ps2 As Process = Process.Start(saveas)
    count += 1
    End Sub
    End Class
    Thanks

  • Automator: Impossible to rename file using automator under Mac OS X Lion

    Hi,
    Before upgrade my iMac to MAC OS X Lion 10.7.2, I had service created with automator under snow leopard in order to rename my pictures file names by blocks instead of one by one. Since I'm using Lion, this one doesn't work anymore. I have completely recreate the service under Lion and the results is the same.
    You can find below my workflow that is easy. The problem is the message error in the history of automator application. The message is "impossible to rename file "file name" because this one should create conflict with existing file". I already test a lot of times with different name where I'm sure that this one doesn't exist on my Mac but all the time without success (verify also with search function under mac)
    If somebody can help me, it would be very interesting because I already tried to find answer on internet without success too.
    Thanks in advance for your help.

    the whole automator and in particular the record action was substantially rewritten in snow leopard. and the record action is slow, unreliable and you can't trouble-shoot it. it's a wonder it works at all. the only advice i can give is to use it as little as possible. if at all possible avoid it altogether. if you do need to use it try using keyboard strokes instead of the mouse movement. for example. use command+c and command+v for copying and pasting and use tabbing to choose the correct box on the page.

  • Renaming files with invalid characters in their names on NTFS partitions, introduced by operating systems other than Windows

    Essentially, Linux created some files with colons (:) in the name on a NTFS partition where I have Windows installed. I have since uninstalled Linux, but now I can only view these files in Windows Explorer. I can't open them, I can't even rename them to
    correct the problem. It's as if they don't exist, because of the invalid search paths.
    If I try to rename them in Windows Explorer I get following message.
    The file name you specified is no valid or too long.
    Specify a different file name.
    Well isnt' that something?... isn't that nice? Windows is able to display these files, but it doesn't allow me to open them and it certainly doesn't like me to rename them. So why is it whining about it then, when I'm trying to help? It says "try a different
    file name". Yeah, right! Like I haven't tried that one already! It doesn't matter what file name I input it will never accept it.
    So what am I supposed to do now? Ditch Windows and go back to Linux? Surely, Microsoft doesn't like the sound of that. Sure, I could reinstall Linux or run a Linux live system to correct the problem. But what good is Windows then? I might as well switch to
    Linux altogether.
    After doing some research I now know by fact that it's (kind of) possible to rename files from UNIX and UNIX-like operating systems to those compliant with Windows by using something called file name character translation. To some level this is essential and
    necessary for Windows interoperability with other operating systems (Windows is not the only operating system in the world). But this seems to be very complicated and I can't get my head around it. My brain is in overload. I don't know where to start.
    Once there was a...
    There's the Windows Services for UNIX (SFU) 1.0, 2.0, 3.0, 3.5. The first two versions were based on MKS Toolkit, a package licensed by Microsoft from MKS Inc. The later versions were based on the similar Interix product, after Microsoft purchased the company
    that made it.
    Then there's the new Subsystem for UNIX-based Applications (SUA). These are services for UNIX components. They are supposed to have Client for NFS v3 included as well. But the server components from the SFU line is missing (e.g. Server for NFS). These are included
    in Server editions of Windows.
    Then there's the Microsoft Knowledge Base article
    289627: "How to Enable File Name Character Translation". This article seems to describe exactly my situation.
    Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system, however, is different. For example, a UNIX file name can use a colon (:), but a Windows
    file name cannot use a colon (:). If a UNIX user attempts to create a file with a Windows illegal character on a Windows Services for UNIX network file system (NFS) share, the attempt is unsuccessful and the UNIX client computer receives an input or output
    error.
    It goes further than that. At first glance, this KB article also seems to offer a solution to this exact problem, with examples as shown below.
    For example, the following maps the UNIX colon (:) to a Windows dash (-):
    0x3a : 0x2d ; replace client : with - on server
    I checked these values in charmap.exe and they are correct. Except for 2D not being a "dash", it's rather a hyphen ("hyphen minus" to be exact), but these two have pretty much the same appearance and they get interchanged a lot, I'm sure
    they are used to it by now. (Yes, the characters! They don't mind.)
    Then there's this registry key.
    HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
    Well, of course, I don't have Server for NFS. So this is a dead end. Well, actually, it was a dead end from the beginning...
    1. First of all, I'm not working with a network share on a NAS or SAN storage. The files are on the local disk drive where Windows is installed, so that's a DAS for you.
    2. I don't have SFU! Well obviously, I'm on Windows Vista! So that means SUA!
    3. SUA are service components only. No server components. Can you guess what that means? Yeah... no "Server for NFS" since it's a server component.
    4. Windows Vista is a client side operating system! Server for NFS is only offered for use with Windows Server systems.
    5. Back to square one!
    So there you have it. They all lived happy for the rest of their lives...
    I'm stuck here. Can someone tell me what to do? I mean beyond the obvious option to use Linux to fixa a Windows problem? The NTFS file system itself supports colons in file names. It's Windows that doesn't, and so by default it proclaims it invalid character.
    Surely, even a Windows client operating system like Windows Vista should be able to allow the user to at least rename files with invalid characters to something more sensible (from the system point of view) and valid, if not being able to open them as they
    are. Just add some crazy voodoo code to it and it will work. If you can make it possible on Windows Server with UNIX user-mode subsystem on NT kernel, then what's stopping you from giving the Windows client system the same benefit?
    So what now? Purchase a Windows Server 2012 R2 license, copy my invalid files to a NAS share with NFS on a UNIX or Linux system, and have a go at the Windows registry and Server for NFS? Yeah... you're right, it's probably a bit over the top...
    On a second thought... I might as well install Linux again. There are countless situations where Linux has helped me solve problems related to, and more often than not caused by Windows.

    Essentially, Linux created some files with colons (:) in the name on a NTFS partition where I have Windows installed. I have since uninstalled Linux, but now I can only view these files in Windows Explorer. I can't open them, I can't even rename them to
    correct the problem. It's as if they don't exist, because of the invalid search paths.
    If I try to rename them in Windows Explorer I get following message.
    The file name you specified is no valid or too long.
    Specify a different file name.
    Well isnt' that something?... isn't that nice? Windows is able to display these files, but it doesn't allow me to open them and it certainly doesn't like me to rename them. So why is it whining about it then, when I'm trying to help? It says "try a different
    file name". Yeah, right! Like I haven't tried that one already! It doesn't matter what file name I input it will never accept it.
    So what am I supposed to do now? Ditch Windows and go back to Linux? Surely, Microsoft doesn't like the sound of that. Sure, I could reinstall Linux or run a Linux live system to correct the problem. But what good is Windows then? I might as well switch to
    Linux altogether.
    After doing some research I now know by fact that it's (kind of) possible to rename files from UNIX and UNIX-like operating systems to those compliant with Windows by using something called file name character translation. To some level this is essential and
    necessary for Windows interoperability with other operating systems (Windows is not the only operating system in the world). But this seems to be very complicated and I can't get my head around it. My brain is in overload. I don't know where to start.
    Once there was a...
    There's the Windows Services for UNIX (SFU) 1.0, 2.0, 3.0, 3.5. The first two versions were based on MKS Toolkit, a package licensed by Microsoft from MKS Inc. The later versions were based on the similar Interix product, after Microsoft purchased the company
    that made it.
    Then there's the new Subsystem for UNIX-based Applications (SUA). These are services for UNIX components. They are supposed to have Client for NFS v3 included as well. But the server components from the SFU line is missing (e.g. Server for NFS). These are included
    in Server editions of Windows.
    Then there's the Microsoft Knowledge Base article
    289627: "How to Enable File Name Character Translation". This article seems to describe exactly my situation.
    Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system, however, is different. For example, a UNIX file name can use a colon (:), but a Windows
    file name cannot use a colon (:). If a UNIX user attempts to create a file with a Windows illegal character on a Windows Services for UNIX network file system (NFS) share, the attempt is unsuccessful and the UNIX client computer receives an input or output
    error.
    It goes further than that. At first glance, this KB article also seems to offer a solution to this exact problem, with examples as shown below.
    For example, the following maps the UNIX colon (:) to a Windows dash (-):
    0x3a : 0x2d ; replace client : with - on server
    I checked these values in charmap.exe and they are correct. Except for 2D not being a "dash", it's rather a hyphen ("hyphen minus" to be exact), but these two have pretty much the same appearance and they get interchanged a lot, I'm sure
    they are used to it by now. (Yes, the characters! They don't mind.)
    Then there's this registry key.
    HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping
    Well, of course, I don't have Server for NFS. So this is a dead end. Well, actually, it was a dead end from the beginning...
    1. First of all, I'm not working with a network share on a NAS or SAN storage. The files are on the local disk drive where Windows is installed, so that's a DAS for you.
    2. I don't have SFU! Well obviously, I'm on Windows Vista! So that means SUA!
    3. SUA are service components only. No server components. Can you guess what that means? Yeah... no "Server for NFS" since it's a server component.
    4. Windows Vista is a client side operating system! Server for NFS is only offered for use with Windows Server systems.
    5. Back to square one!
    So there you have it. They all lived happy for the rest of their lives...
    I'm stuck here. Can someone tell me what to do? I mean beyond the obvious option to use Linux to fixa a Windows problem? The NTFS file system itself supports colons in file names. It's Windows that doesn't, and so by default it proclaims it invalid character.
    Surely, even a Windows client operating system like Windows Vista should be able to allow the user to at least rename files with invalid characters to something more sensible (from the system point of view) and valid, if not being able to open them as they
    are. Just add some crazy voodoo code to it and it will work. If you can make it possible on Windows Server with UNIX user-mode subsystem on NT kernel, then what's stopping you from giving the Windows client system the same benefit?
    So what now? Purchase a Windows Server 2012 R2 license, copy my invalid files to a NAS share with NFS on a UNIX or Linux system, and have a go at the Windows registry and Server for NFS? Yeah... you're right, it's probably a bit over the top...
    On a second thought... I might as well install Linux again. There are countless situations where Linux has helped me solve problems related to, and more often than not caused by Windows.

  • Need a script to do the following... rename files based on folder name...

    Hi. Macophile just starting to tread the waters of Applescript, trying to use Automator but don't think it will do what I need.
    I have many images stored with-in folders that I would like to extrapolate a given number of characters from the folder name and Add Text to the files within those given folders.
    Basically...
    Folder name is C00100_Descriptive
    Files within folder are just Descriptive_01, Descriptive_02
    Would like to make all files within a given folder take the first 7 characters from the folder and Add that text to all files and files within subfolders of that folder to make the resulting files shown as...
    C00100Descriptive01
    C00100Descriptive02
    Along with this I would also like to incorporate into the script, an added step to create Thumbnail jpegs of the image files in a Subfolder under C00100_Descriptive folder.
    I can see how to do that in automator but not specifying parameters such as taking a certain number of characters from the folder the file resides in and adding that selected text to the files.
    Ideally I would like a droplet or something that I could take a bunch of folders and drop them on the droplet to perform these actions.
    Any advice, help or guidance would be really helpful! Thanks in advance.

    Awesome, you're quite welcome, glad to hear it worked for ya!! Here's another version of the script that will rename the thumb files as jpg...
    <pre style="width:630px;height:auto;overflow-x:auto;overflow-y:hidden;"
    title="Copy this code and paste it into your Script Editor application.">on run
    set theItems to choose folder with multiple selections allowed
    open (theItems)
    end run
    on open (itemList)
    repeat with anItem in itemList
    set theInfo to info for anItem
    --VERIFY THAT THE OPENED ITEM IS A FOLDER
    if folder of theInfo and not package folder of theInfo then
    --SET PATH TO THE FOLDER
    set theFolder to POSIX path of anItem
    --GET FIRST PART OF FOLDER NAME
    set folderNameStart to do shell script "echo " & ¬
    quoted form of (name of theInfo) & "|awk -F'_' '{print $1}'"
    --GET ALL FILE NAMES
    set fileList to list folder anItem without invisibles
    --PROCEED IF FOLDER NOT EMPTY
    if fileList is not {} then
    --SET PATH TO THUMBNAIL FOLDER
    set thumbFolder to theFolder & "_thumbs/"
    --CREATE FOLDER IF IT DOESN'T ALREADY EXIST
    try
    do shell script "mkdir " & quoted form of thumbFolder
    end try
    --PROCESS FILES
    repeat with fileName in fileList
    --SET PATH TO CURRENT FILE
    set oldFile to theFolder & fileName
    --PROCEED IF FILE IS NOT A FOLDER
    set oldFileInfo to info for POSIX file oldFile
    if not folder of oldFileInfo then
    --SET NEW FILE AND THUMB FILE PATHS
    set newFileName to folderNameStart & "_" & fileName
    set newFile to theFolder & newFileName
    set theExt to name extension of oldFileInfo
    set thumbName to text 1 through -((length of theExt) + 1) of newFileName & "jpg"
    set thumbFile to thumbFolder & "thumb_" & thumbName
    --RENAME FILE
    do shell script "mv " & quoted form of oldFile & space & ¬
    quoted form of newFile
    --CREATE THUMBNAIL
    --REPLACE '128' WITH MAX HEIGHT OR WIDTH OF THUMB
    try
    do shell script "sips -s format jpeg -s dpiHeight 72 -s dpiWidth 72 -Z 128 " & ¬
    quoted form of newFile & " --out " & quoted form of thumbFile
    end try
    end if
    end repeat
    end if
    end if
    end repeat
    end open</pre>

  • 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

  • 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)

  • Are Renamed Files or Renamed Folders backed up again?

    Does Time Machine perform any sort of Content oriented backups to the TM volume? I seem to remember reading somewhere that it did, but only at the file level. In other words, is the entire file or group of files backed up again if:
    1. The file is renamed?
    2. An enclosing parent folder is renamed?
    3. File attributes have changed? If so, is the whole file backed up again?
    4. Only a resource fork is changed? If so, is the whole file backed up again?
    5. Duplicate files with different names or different locations?
    If there is no commonality processing to avoid backing up data more than once like DataDomain or EMC Avamar, might there be in the future?

    JeffCMKRNL wrote:
    Does Time Machine perform any sort of Content oriented backups to the TM volume? I seem to remember reading somewhere that it did, but only at the file level. In other words, is the entire file or group of files backed up again if:
    1. The file is renamed?
    yes.
    2. An enclosing parent folder is renamed?
    yes
    3. File attributes have changed? If so, is the whole file backed up again?
    yes
    4. Only a resource fork is changed? If so, is the whole file backed up again?
    yes
    5. Duplicate files with different names or different locations?
    yes
    If there is no commonality processing to avoid backing up data more than once like DataDomain or EMC Avamar, might there be in the future?
    none of us here work for apple so we wouldn't have any idea but I extremely doubt it.

  • Rename files and retain portions of the original filename

    I posted a thread about this a while ago, but no solution was given:
    http://discussions.info.apple.com/thread.jspa?threadID=2564646
    The issue is this: I can't figure out how to rename imported files while also retaining part of the original filename. The images come off of the camera like this:
    DSC_3497.nef
    I need to do the following:
    +- Retain the unique number that the image already has. I don't want to rename the files by date, location, lunar phase, or some other esoteric identifier. I think having a unique ID for each image (one that shows up in standard OS-level searches on both Mac and PC systems) is useful.+
    +- Replace "DSC" with the camera model (D3X), since I use multiple cameras with different resolutions and also need to be able to search for images from a certain camera outside of Aperture (i.e. tags/keywords would not help).+
    +- Add a digit prior to the four-digit string to indicate the true numeric sequence of the file. Since Nikon cameras reset the number sequence every 10,000 files, I want to indicate the true sequence number directly in the filename. This will also avoid filename overlaps. It also lets me know how many images I've shot with each camera.+
    The intended final result would look like this:
    D3X_63497.nef
    Showing the 63,497th image taken with my D3X.
    In Aperture's "File Naming" dialog, I don't see a way to split the existing filename in this way. It looks like I can only append or prepend a Custom Name to the Version/Master name. I don't see a way to split the existing filename at the underscore, for example, so that portions of the original filename can be selectively replaced.
    This is not about finding a workable naming scheme for Aperture and then renaming all existing files. I spend time on the PC side for various things and also work with a number of people who don't use Aperture but need access to my image library. I also have hundreds of references to existing filenames in various print and web design projects, as well as my Flickr account with 3000+ photos.
    Going back and updating all that stuff is not going to happen. But using a System Service to rename files after every import is also pretty tedious.
    Any solutions that meet the three criteria outlined above would be greatly appreciated.

    sempervirent,
    You're asking for some pretty advanced file naming. Most people aren't going to need that sort of function, so I doubt there will be a hook into Aperture to do such a thing. I suggest using a shell script or Applescript along with EXIFTool to rename files before you import them into Aperture. http://www.sno.phy.queensu.ca/~phil/exiftool/
    Retain the unique number that the image already has
    If you're not afraid of the command line, it's easy enough to use a tool like awk or maybe perl to parse that sequence number from a well-formatted string like the picture name
    Replace "DSC" with the camera model (D3X)
    You can use EXIFTool to extract the camera model from the EXIF dat ain the photos
    Add a digit prior to the four-digit string to indicate the true numeric sequence of the file.
    Good luck with this one. You'll have to do a filename search through all of your previous files to find out what 10,000 you're on. It's possible, but you'd have to do some specialized coding in AppleScript or shell script.
    nathan

  • Rename/Batch Rename files

    I use PSE 5.
    I name all my images before I import them into Organizer. Here is an example: 2007-11-01 071500 Bolsa Chica pelican -- meaning this picture of a pelican was taken November 1, 2007 at 7:15AM. I may have a dozen or more images of pelicans from that day, but taken at different times obviously. If I would like to rename/batch rename these files to indicate brown pelicans instead of just pelicans, can I do it within the program and still retain the date and the different times for images?
    I can't find a way to do it. And I've searched this site as well as The Missing Manual. I've been using PSE since Ver. 3, but have always used another program to batch rename files. I'm guessing Adobe expects users to rely on tags, otherwise they would have a more "sophisticated" batch rename capability.
    But am I missing something about batch renaming? Sorry for the very long post . . .
    Wendell

    I have several bones to pick with PSE5's file rename ability (in Organizer, go to File, Rename), primarily the 30-character limit on new names.
    I use long file names like
    2007-11-11 Al and Nadia wedding NYC roses-1.jpg
    2007-11-11 Al and Nadia wedding NYC roses-2.jpg
    2007-11-11 Al and Nadia wedding NYC Peter and Julie.jpg
    The spaces make for easier legibility to humans.
    If I were to include these files in a web address, I'd use hyphens.
    For this past Thanksgiving I toiled over the metadata in a group photo that might become important for family history, adding title, caption, keywords, date. I found that the "Save for Web" dialog strips some or all of the metadata, and other programs might or might not read or preserve the metadata.
    A number of people who receive my photos cannot readily use the metadata:
    --Naive users (gram and gramps)
    --Busy and distracted users (the niece who is a mother of 3; the day-trader who's thinking about his puts and calls)
    --People with poor support (a friend who has some sort of Photoshop Starter edition at work that does not recognize keywords; and she can't justify even Photoshop Elements)
    Even among all these folks, almost no one is using an operating system that requires short names.
    So, I put an abundance of information into my file names. Photoshop Elements allows that ON IMPORT, but not after the fact IN THE ORGANIZER.
    I just hope that this inconsistency is fixed in PSE6. I get tired of explaining this over and over again to folks.
    -- Bob
    P.S. I love Photoshop Elements, but I'm looking into moving my picture store to my MacBook Pro, and using Bridge (already installed) and GraphicConvert to manage my photos.

  • Rename files recursively

    Hi Expert,
    I am having a hard time renaming files within subfolders, i have this script:
    Get-ChildItem  -Recurse | where {$_.name -match "^(_2014-|2014-)"} | % { rename-item $_ "_000000$($_.name)"}
    it does rename the files on the current folder but in the subfolders keeps throwing this error;
    Rename-Item : Cannot rename because item at filename  does not exist. much appreciated
    Regards

    I have upgarde to powershell 4 but none of the scripts works,
    1-  the first script there were no error msgs,  i had executed the script as it is just changed the path of the folder, 
    Set-Location -Path "C:\test"
    2- Rename-Item : Illegal characters in path.
    At C:\rename1\test.ps1:3 char:9
    +         Rename-Item $_.Fullname ('{0}\"_000000{1}' -f $_.Directory.Fullname,$_.n ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Rename-Item], ArgumentException
        + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.RenameItemComman
    Rename-Item : Illegal characters in path.
    At C:\rename1\test.ps1:3 char:9
    +         Rename-Item $_.Fullname ('{0}\"_000000{1}' -f $_.Directory.Fullname,$_.n ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Rename-Item], ArgumentException
        + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.RenameItemComman

Maybe you are looking for

  • Payment terms in vendor  Master

    Hi, In XK01- create vendor master, There are two payment terms--> payment transaction field and other in purchasing organisation data. Is there a configuration which will default the payment terms in purchasing org screen based on the inputs in the c

  • BW Report iview and SSO w/Logon Tickets

    I have some BW Report iviews configured which work great for me however I can't get them to work for any other endusers.  I have administrator access and they do not.  The error they get is; Unable to lookup System 'aBWP100'. Please check the system

  • Default value question

    I have field defined in table: <br>STATUS INTEGER DEFAULT 1, CONSTRAINT MYTAB_STATUS_CK CHECK (STATUS IN (0,1)) <br>For filling that field in form I'm using LOV that is defined as static list: <br>STATIC:Inactive;0,Active;1 <br>When this field is sho

  • Are deleted iMessages for iPhone 4 recoverable?

    I deleted a very important message. It was an iMessage and not a traditional text message. Is this recoverable? I'm willing to go to a data recovery service if that's necessary.

  • PM notification - user exit for task list?

    Hi everyone, I'm looking the way to set default values in task list when creating a PM notification (IW21). For example, I want to set default planned finish date while manualy inserting tasks. Is that even possible? I have checked available exits QQ