Mass filename changes using terminal? How?

Hello,
I recently put a Linksys NAS on my network. Unfortunately, the EXT3 format used on the disks does not like filenames with special characters such as "/" or "?". So I cannot copy files from my PowerBook to the NAS with these characters in their names.
A search of my hard drive shows 800+ files with these forbidden characters.
Is there a way to use terminal (or any aspect of OS X) to do a mass change of these characters to a more acceptable character (i.e. changing all instances of "/" to "-")?
Thanks for the help.
Jim

Jim
tcsh: Invalid null commandAh, you're using tcsh. Bad news! I'm sure it could be made to work, but I've switched to bash because it is better for this sort of stuff. Gary will tell you to switch to zsh, but for now bash will do. I just tried the command as posted and tcsh complained loudly!
First point: often when you try to copy/paste from a browser window, you get an extra space appended to the line. It often doesn't matter, but it could here (may explain the "tcsh: Invalid null command" message). So copy the commands into a TextEdit document, which you have changed to Plain Text from the Format menu. Then be sure not to include any trailing space.
Second point, we'll scrap the use of sudo since it is only your Home directory that you are interested in.
Third point: as I said, we'll use bash. The prompt will change to a '$' instead of a '%'. When you've finished, you can return to tcsh with a plain exit command.
So, copy and paste the following into the Terminal window, one line at a time, with a return after each line:
<pre>bash
find -d ~/Documents \( -name "?" -o -name ":" \) -exec echo 'mv "{}" `echo "{}" |
sed -e "s^\?^_^g" -e "s^:^-^g" ` ' \; | sh</pre>This should work—it did for me!
Note:
it returned a > prompt with nothing else on the line.It will do this after the second line above—it is an invitation to complete the command

Similar Messages

  • Using Terminal how do I mount a USB Fat16 formatted drive

    I want to be able to look at the files stored on a USB drive (name is TravelDrive) in Terminal. If a enter mount it shows the drive on /dev/disk1s1 but can't figure out how to actually mount it

    These commands worked for me:
    sudo mkdir /volumes/traveldrive                                         //Create Mount Point
    sudo mount -t msdos /dev/disk1s1 /volumes/traveldrive     //Mount Volume
    I was just curious about how to do this in terminal.

  • App for mass filename change

    Can anyone recommend an application for making "smart" mass file name changes?
    Example:
    I want to find an application that will:
    1.  Search through file names for a year.
    2.  Put a particular word in front of the year (without wiping out the year).
    I have Massreplaceit, but I do not think that it would do this.
    Can anyone recommend a different app?
    OS 10.8 imac
    Thanks.
    mac

    Hi, try this one...
    http://www.publicspace.net/ABetterFinderRename/

  • How to download a file from the internet using terminal

    how to download a file from the internet using terminal
    does any one know how to download afile from the internet using the Terminal application?

    Use curl. Something like this:
    curl -O http://www.example.com/filename.zip
    For more info, type +man curl+.

  • Hey,i forgot my login password,so i changed the password by using terminal command(reset password).now i have new user name with new password,but i can't find  my data which i have saved on mac.please help me out in this matter.

    hey,i forgot my login password,so i changed the password by using terminal command(reset password).now i have new user name with new password,
    but i can't find  my data which i have saved on mac.the storage is showing data used and free space on the disk
    please help me out in this matter.

    How did you change your user name?
    resetpassword wouldn't have done it. If you managed to create a new user, then your data is still in the old account.

  • How to use Terminal to Find or Locate files without extensions?

    I'm conversant with the cli, but not a power-user.  I've discovered a fairly large number of audio files, across dozens of sometimes nested folders, that (somehow) lost their '.aif' extension and now appear as Unix Executable Files.  Upon appending said files with the proper extension, they are perfectly normal audio aif's.
    My Problem: using the Terminal, how can I search a directory tree to find those files *without* an extension, discriminating between files and folders, and then append the correct extension to only the files?
    I've tried a number of queries, mostly built around the idea of using 'filename.*', but for some reason searching for an extension omission (as opposed to a specified string) isn't so simple. 
    The following: ls -al *.
    Brings up 'No such file or directory'
    And the following ls -al .*
    Brings up files AND directories
    I need o discriminate between files and directories, finds all files without extensions, and rename them with the appropriate extension.
    Can anyone help?
    Best, Tom

    The following will find files without a file extension in the current working directory and any sub-directories->
    find . -type f ! -name "*.*"
    If you are confident that the files found are the appropriate audio file (in this case aif) then you could->
    find . -type f ! -name "*.*" -exec mv {} {}.aif \;

  • HT1311 I changed my apple id and have a gift card credit on the old account which I no longer use.  How do I transfer the gift card $ to my new apple id?

    I changed my apple id and have a gift card credit on the old account which I no longer use.  How do I transfer the gift card $ to my new apple id?

    Click here and request assistance.
    (75296)

  • How to use Terminal with KeySpan USB serial adaptor cable?

    I own a KeySpan model USA-19HS to use with our MacBookPro when working on clients networking equipment that require serial communication. I have used ZTerm with excellent luck, but it costs, and is yet another application that I dont really want. I would like to know if any one out there has exacing instructions on how to use Terminal with this adaptor. If I could write a file that had, say, the couple most common settings (9600-8-n-1, 57600-8-n-1, et cetera) that I could simply click on, to open a new Terminal window with those settings, then simply close that, and open a new window (apple+n) in order to get back to a default settings terminal window. All feedback is most appreciated.
    Thanks so much, Jason Sjobeck

    Hi, Jason. Welcome to the Discussions.
    You wrote: "All feedback is most appreciated."OK.
    1. Have you considered discussing this with Keyspan Support?
    2. Have you read the section "OSX has Terminal.app - why do I need ZTerm?" on the ZTerm Home Page? That seems to explain why one needs an app like ZTerm.
    3. A quick search of Keyspan's FAQ for your product and terminal doesn't yield much more than how to find the serial ports using Terminal.
    Likewise, this Google search also yields little, and variants of that search of such weren't particularly help either.
    It appears your inquiry seems to be a somewhat esoteric topic.
    4. Apparently, ZTerm X is a bit long in the tooth and there's no Universal Binary for it. It sounds, however, like you've tried it running on your MBP under Rosetta, yes?
    5. In researching alternatives to ZTerm for you, I note the followng:• The comment from "Reverb" on this page suggests C-Kermit or Kermit as a free alternative.
    • This tip on Mac OS X Hints cites Minicom as another option.6. You may want to try your question on the Unix Discussion.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • I have an apple id but the email address that they send a reply to is one I no longer use. How do I change this in my profile? It does not show up as an add'l email address to delete

    I have an apple id but the email address that they send a reply to is one I no longer use. How do I change this in my profile? It does not show up as an add'l email address to delete

    "The reply" as in the Rescue email to reset your Security Questions? If so, then you will have to contact iTunes Support directly to get them reset:
    ACCOUNT SECURITY CONTACT NUMBERS
    Cheers,
    GB

  • My old appleID use email with domain already deactivate. So I changed my appleID and primary email and now I can not access iCloud with iOS7. ICloud shows my old appleID but I can't change it. How do I get iCloud to work with my updated ID?

    My old email that using register for apple ID cannot access/check any mail because that domain already deactivate.
    So I changed my appleID and primary email and now I can not access iCloud with iOS7. ICloud shows my old appleID but I can't change it. How do I get iCloud to work with my updated ID?

    Hi ccharat,
    Welcome to the Apple Support Communities! It sounds like you did a good job editing your Apple ID and primary email address, but you didn’t sign out of iCloud on your iOS device before hand. What you may need to do in this situation is go back to the Apple ID website and edit your Apple ID and primary email address back to the email address that is signed in with iCloud (there is no need to verify the account after editing it back to the old account, just changing it back is enough). Once your Apple ID is back to the original account, delete the iCloud account from the iOS device and be sure to keep all info on the device when prompted. After you delete the iCloud account, go back to the website and edit your Apple ID and primary email address back to the new address. Once it is back to the account you would like, you can sign into the iCloud on the iOS device with that new account and merge all of the data when prompted. Please use the following article as a reference.
    iOS 7: If you're asked for the password to your previous Apple ID when signing out of iCloud
    http://support.apple.com/kb/ts5223
    Change your Apple ID temporarily
    If signing out and back in to iMessage or FaceTime didn't help, try these steps:
    Change your Apple ID to the Apple ID you used previously. You shouldn't need to verify the email address.
    Go to Settings > iCloud. Complete these steps only if the Find My [Device] setting is turned on:
    Scroll down and tap Delete Account, then tap Delete to confirm.
    Tap “Keep on My [Device]” or “Delete from My [Device].” In either case, your data remains in iCloud and will be updated on your device when you sign in to iCloud again.
    Enter the password for your previous Apple ID.
    Change your Apple ID to the new email address that you want to use. You'll need to verify the email address.
    Return to Settings > iCloud and sign in with your new Apple ID.
    I hope this helps,  
    -Joe

  • Using terminal to change IP address

    One emac has gone odd. It refuses it acknowledge the server and it has locked its IP address off the network. It retains the server prefs and won't let me use the sys prefs to open network. (I work in a school - obviously I lock them 80 ).
    Can anyone tell me which file(s) I need to find on the client to change the IP address using terminal please. I've been looking at files in /etc where I think it should be but can't find anything.
    Muchos gracias,
    Danke viel mals
    Merci bien
    Thanks
    Mark

    Hi Candor,
    try man ifconfig !

  • After trying to change permissions on my computer so others on my network can access files, my external Hard Drive has a lock on it and I can't access files. I've tried repairing permissions, logging in under another Administrator account, using Terminal

    After trying to change permissions on my computer so others on my network can grab files, my external Hard Drive has a lock on it and I can't access files. I've tried repairing permissions, logging in under another Administrator account, using Terminal to fix the problem, downloaded BatChmod but nothing works… Any other suggestions? I have an Imac running OS10.6.8.

    There is suddenly a lock icon on my external backup drive!
    Custom Permissions

  • Terminal - how to find my external hard drive using unix commands

    just discovered terminal and using cd and ls commands, which are the only commands i know, i realized that i can't find my external hard drive. i thought it would be listed on my desktop, as it is in the OSX interface, but it isn't there.
    not that im skilled enough to use terminal yet, but i thought the first step would be being able to navigate the computer's files.
    really curious as to where my external hard drive is and how i can find it using unix commands in terminal.
    i was trying to figure it out myself, then i thought surely someone knows this and could tell me in a sec.
    thanks.
    ibook   Mac OS X (10.4.4)  
    ibook   Mac OS X (10.4.4)  

    "ls /Volumes" will list all volumes, including internal and external hard drives and mounted disk images. I find "disktool -l" more useful in scripts, as it tells you which volume names correspond to which "mount points" under /Volumes. Usually they're the same, but if you have two volumes with the same name, or you try to remount a removable volume before it is fully unmounted, you'll end up with a mount point that consists of the volume name with a numerical suffix.

  • EXIF Dates - how to add/change using exiv2 . . . is there a better way?

    Hi, everyone!
    INTRO: I'm new to Lightroom. I've gone through a few books and lots of tutorial courses on lynda and youtube, so I feel quite comfortable with LR 5's import process. This post and question is a pre-import/organizational issue.
    I have more than 30,000 old, digitized (scanned) photos dating back to the 1950s. Obviously, most of were taken with old, analog cameras. These are now organized into folders by date.
    GOAL: I want to import these photos into LR and be able to find them by metadata dates (Capture Date & Time).
    PROBLEM: Obviously, old scanned (or even more recent manipulated) photos often don't have the correct EXIF creation date info. Even worse, many (or most) of these old images don't even have an EXIF date field!
    WHAT I'VE LEARNED: Using exiv2 filename or evix2 -pt filename immediately shows whether there is or is not date info for the photo. If there isn't, exiv2 -pt filename shows nothing. If there is an EXIF date field, it will be shown.
    For all these images with no date field, if I import them into Lightroom, there of course is no date info that shows up in the Metadata panel (under Default or EXIF), nor can you change the date (because the field isn't even there).
    If exiv2 -pt filename DOES show the Exif.Image.DateTime field, then in Lightroom, you will see the Capture Time and Capture Date fields, and you will see an icon to the right of those dates that allows you to change that date.
    If exiv2 -pt filename DOES NOT show this Exif.Image.DateTime field, you can ADD this field by using the command line:
    exiv2 -M"set Exif.Image.DateTime Ascii 1965:01:25 15:45:00" filename (or whatever your date/time is).
    Now if you import this image into LR, you will find the Capture Time and Capture Date fields under the Metadata > Default panel...AND you can edit them if needed. That is, the above exiv2 -M command added the EXIF date field that LR needs in order to search by date.
    WHAT'S MY POINT, AND WHAT'S MY QUESTION? I have no problem using exiv2 to add/change an EXIF creation DateTime field one folder at a time prior to importing them into LR. This will enable me to search on those date fields**.
    My question is this: Is there an easier method?
    Surely there must be tens (hundreds?) of thousands of "older" photographers like myself who have troves of old photos that have incorrect EXIF creation date fields, or missing the date field entirely (in which case, as I stated above, cannot be added/edited using LR, PS, FileMultiTool, Graphic Converter, etc.).
    I realize that I could look at images based on the folder names or file names, or I could enter dates into tags, but such methods of finding images are not nearly as convenient as using Metadata. Therefore, if I know that an image was taken in June 1962, then I'd like the EXIF metadata to have this info so that I can search on it. To have no EXIF date field or to have a date field that is incorrect is useless.
    I'D LOVE YOUR COMMENTS! If there is an easier or better way, I'd love for you to help! There are so many experienced photographers on this forum, and more than likely many of them have old photos with incorrect or missing EXIF date fields that they've brought into LR.
    THANKS! I'll really appreciate any and all help you can offer.
    David
    ** there are other EXIF date fields that can be changed using exiv2: Exif.Photo.DateTimeOriginal, Exif.Photo.DateTimeDigitized, etc. But the principal date that LR uses to search for files is the one described above.
    P.S. I've also tried jhead -ds1965:01:25 filename (or whatever your date is) to change the date. This works ONLY IF there is already an EXIF date field present. If not, jhead will report an error and not create one. exiv2 -M will create the field.

    John,
    Thanks very much for your help! I had tried the plugin, exiv2, exiftool, and LR's Metadata menu option only on a single photo.
    You are 100% correct about LR's menu option assigning different times! Thank you for pointing this out.
    When I set the date and time for about 10 photos, LR's menu option assigned (seemingly random!) times to all of them. Why would LR do this? I can perhaps see offsetting each photo by 1 second (00, 01, 02,...), but simply assigning random times makes no sense at all. At least in the tests I just did, LR didn't shift the time by the same amount, but assigned totally (random?) times to every photo.
    Another problem that I found with the LR menu item is that it failed to change the date/time at all for several of the images I selected! The Capture Time To Exif plugin, exiv2, and exiftool had no problem at all with the same photos.
    I also looked at the ExifMeta by Rob Cole that you mentioned. It looks very powerful (and is free), but much more complex than what I need at this point.
    Therefore, I purchased the Capture Time To Exif plugin, and it works great on multiple photos.
    I now have good methods to change the date for multiple images:
    1. Prior to import: exiv2 or exiftool
    2. After import: John's Capture Time To Exif plugin
    Thank you again for your help!
    This brings me one step closer to importing my photos in a logical method.
    David

  • I changed my appleID but iCloud is still using the old one and no place to change it.  How do I get iCloud to update to the new ID?

    I changed my appleID but iCloud is still using the old one and no place to change it.  How do I get iCloud to update to the new ID?

    You have to sign out completely and then sign back in.
    On a Mac, System Preferences>iCloud and click 'Sign out'.
    On an iOS device, Settings>iCloud and click 'Delete account' (this will not delete the account from the server).
    Your synced data will disappear from your devices when you sign out, but reappear when you sign back in (give it time).

Maybe you are looking for