Can applescript do that or should I look into an other solution?

hello there,
I have a few thousand files called 001.txt, 002.txt etc, the first line of each texts is always its title
I need each file to be called "it's tittle".txt.
I'm just a mac end user, but I'm planning to create a script that take the first line of text in a file and makes it the file name. I think it should be ok to do as there are only 2 variables, but as it means a bit of investment time wise, I want to be sure I'm not missing something like a simple way to script it with some scripting prog I never heard about, or even a ready made soft?
The only experience of scripting that have is some quick basic (or should I call it programming?) two centuries ago. I know I can manage a simple script by trial and error with time and big headaches, so I'm not trying to get someone to do the work for me, I just want to know if I'm wasting my time getting ready to study applescript just to create the said script.
All advise most most welcome.
Best wishes!
T

Be extremely careful poiting this script to the proper directory containing your files. All this script does is ask you for a folder, finds all the files located in that folder, and renames all those files to the first line of text in the file. So, please choose your directory wisely!!
<pre style="margin:0px;padding:5px;border:2px dotted green;width:630px; height:auto;color:#ffffff;background-color:#000000;overflow-x:auto;overflow-y:h idden;font-family:Verdana, Monaco, monospace;font-weight:bold;font-size:12px;"
title="Copy this text and paste it into your Script Editor application.">set theFolder to choose folder with prompt "Select the directory in which your files are located:"
set posixPath to POSIX path of theFolder
set theFiles to paragraphs of (do shell script "find " & quoted form of (text 1 through -2 of posixPath) & " -type f -not -name '.*'")
repeat with aFile in theFiles
set newName to paragraph 1 of (read aFile)
do shell script "mv " & quoted form of aFile & space & quoted form of (posixPath & newName & ".txt")
end repeat</pre>
Hope this helps...

Similar Messages

  • I started to download a movie for rent and lost internet connection. Now it tells me to go to my downloads but I can't find them where should I look.

    I started to download a movie for rent and lost internet connection. Now it tells me to go to my downloads but I can't find them where should I look.

    Me too!!! It says check your Downloads, but unable to find Downloads...

  • How to disable Setting button in Tools - Options - Advanced - Network..i've read an article that solved this problem..but thats problem contains web adress that couldn't be opened..any other solution??? thanks before best regard

    How to disable Setting button in Tools - Options - Advanced - Network..i've read an article that solved this problem..but thats problem contains web adress that couldn't be opened..any other solution???
    thanks before
    best regard
    -ariansyah-

    You can disable or remove that button, but that won't prevent users from making the changes on the about:config page directly.<br />
    You can lock the related network.proxy prefs if you do not want users to change the connection settings.
    See:
    *http://kb.mozillazine.org/Locking_preferences
    * http://kb.mozillazine.org/network.proxy.type
    * http://kb.mozillazine.org/network.proxy.%28protocol%29
    * http://kb.mozillazine.org/network.proxy.%28protocol%29_port

  • Can this issue on my iPod touch be fixed or should I look into buying a new one?

    http://i.imgur.com/Fjp5tXO.jpg
    Is this screen issue on my iPod touch 4th gen fixable somehow. I realy don't want to have to buy a new one and I'm fairly sure the warranty is expired. It has been dropped a few times but nothing too serious if I recall right. There is a small dent in the side of the iPod where the little dark spot on the upper left is. Some research I've done suggests that maybe it's an issue with the LCD. Resetting the iPod has no effect. Any and all help would be greatly appreciated. Thanks!

    Looks like screen problem to me..
    Apple will exchange your iPod for a refurbished one for $199 for 64 GB 4G and $99 for the other 4Gs. They do not fix yours.
    Apple - iPod Repair price                                    
    A third-party place like the following maybe less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens         
    Replace the screen yourself if you are up to it
    iPod Touch Repair – iFixit                  

  • Is it worth trying to fix my computer, or should I look into purchasing a new one?

    I currently have an aluminum Macbook from late 2008. It has a 250GB hard drive and 2 GB RAM. I'm running OSX version 10.8.2.
    Recently my laptop has been running really slowly; programs will often just give me the spinning beach ball when I try to open them, searching for files on the hard drive takes forever. Also, if I close the computer without putting it to sleep and then try to reopen it at any point after that, I get a black screen with the spinning beach ball, and I have to reboot the computer before I can use the computer. Applications frequently crash in the middle of using them and I've lost entire assignments as a result (I know I need to save more often, but it's still annoying that I lose entire applications). It started happening really suddenly, there was really no warning
    I'm entirely computer illiterate, and I've gotten varying advice from people I know who are better with computers than I am. Some say to install more RAM and reinstall the the OS, while others say that because the computer is 5 years old, it may be smarter to just go ahead and purchase a new laptop, especially since I will be heavily using my computer next year to write a thesis (various statistics programs, maybe running flash programs/videos for data collection, writing my own programs for data collection and writing the actual paper).
    Just in case it matters, my battery only lasts around 30 mins on a full charge, and I have a few dead pixels on my screen.
    Any advice you guys can give would be super helpful!
    Thanks!

    if your issues were a simple RAM and software reinstall - then I would suggest to keep your Macbook and invest a couple of hundred  $$$.
    but because your battery is toasted - and your screen has some issues - i suggest to get a refurbished Macbook from Apple or get a 2 year old used macbook.
    it's not worth spending x amount of $$$ in your macbook because of the dead pixels in your screen.
    if your screen was perfect, then i would say spend a couple of hundred $$$ and fix it up.
    I still have both my late 2008 Macbook Uni 2GHz and 2.4GHz running perfectly.
    Good luck

  • I have followed the directions, but on both the mobile and desktop the 3 line code that it says to enter into the other device is already filled in and I can't enter either device's code on the other. How do I get around this?

    I can't get any further on either device than "Add a Device".
    The code in the 3 little windows is uneditable on on either device. Both the computer and the phone say "Then enter this code:" but neither one will let me enter anything.

    Sounds like it's hardware issue. The iPhone warranty is based in the original country of purchase. Since it was bought in Korea you will need to ship the phone to someone you know in Korea to be taken in and then they will have to ship it back to you. The cost of shipping will be at your expense.

  • I keep geting re-directed to a wrong site after I click on the search result site. How can I prevent that?

    I keep geting re-directed to a wrong site after I click on the search result site. How can I prevent that?

    iPad or Mac?

  • I can't send emails from my phone when I'm abroad. How can I change that?

    I can't send emails from my phone when I'm abroad. How can I change that?

    try to log into your email from another mobile or device and see if you can, or log out of your email on your phone and log back in see if it works

  • Where can I find that awesome peacock feather wallpaper?

    I'm sorry, I know this is completly off-topic...
    Well, I've been trying to find this wallpaper (http://images.apple.com/macbookpro/images/features17-display20090106.jpg) for weeks with no success. Does anyone knows where I can download it? Or even send it by email?
    Message was edited by: iMacPodshuffle

    I can't find that particular image but here are some other peacock feather wallpapers:
    http://www.wallpaper.net.au/wallpapers/miscellaneous/Peacock-Tail-Feather-Michae l-Maggs-1-1024x768.jpg
    http://www.wallpaperdojo.com/animals/Peacock_Feathers/Animal-Wallpaper.html
    http://wallpapers.graphicfreebies.com/detail.html?640-feathers1
    http://www.ScenicReflections.com/download/28416/
    http://entertainment.webshots.com/album/569449663?start=12
    Just Google "peacock feather screensaver" and you'll find loads more although I must admit none are as nice as the original one you wanted.

  • HT1925 i have a sony vaio laptop and want to uninstall itunes and reinstall it to the newest version so i can sync to my ipad but after going into control panel and the itunes program wont let me uninstall it can anyone help

    I Have a Sony vaio laptop a ipod touch and a new ipad but cant sync from the laptop because the itunes is too old a version.
    I have tried to uninstall itune from the control panel to enable me to reinstall the latest version but wont let me as  it say to contact apple support does anybody have any good idea what to do?

    I have tried to uninstall itune from the control panel to enable me to reinstall the latest version but wont let me as  it say to contact apple support
    What's the precise text of that error message, please? (There's a few different ones I can think of that you might be getting.)

  • I have some loops from acid 5 which I have dragged in a folder to the loop browser.  Some of them retain the folder name in the View: and some don't.  I have had some that seem to go in but I can't find them.  Where should I look?

    I have some loops from acid 5 which I have dragged in a folder to the loop browser.  Some of them retain the folder name in the View: and some don't.  I have also had some that seem to go in but I can't find them.  If I try to add them again, I get a msg that they are already there.  Where should I look?

    It may be best to recreate the folder and the smart playlists from scratch.
    tt2

  • I can't get Safari to load period. It quits immediately. According to the troubleshooting, I'm to un-install any third party plug ins. Can anyone tell me what I should be looking for? I don't recall installing anything that wasn't an upgrade.

    I can't get Safari to load period. It quits immediately. According to the troubleshooting, I'm to un-install any third party plug ins. Can anyone tell me what I should be looking for? I don't recall installing anything that wasn't an upgrade.

    Unplug your iBook from the AC power, shut it down and take the main battery out for about fifteen minutes. Then you can put the battery back in, plug the power back in and restart. This should reset the USB and FireWire ports.
    If that doesn't help, you could reset the Power Management Unit. Follow the instructions in Knowledge Base Article #14449 for resetting your PMU.
    You probably should also startup from your Mac OS X install disk and run the Disk Utility to "repair disk" on your hard drive. This will determine if you've got some kind of file directory/software problems with the files on your hard drive.
    I'm not much at decoding kernel panic logs, but this line jumps out:
    Kernel loadable modules in backtrace (with dependencies):
    com.apple.filesystems.udf(1.4.1)@0x28a79000
    Did you have a DVD movie in the drive at the time? DVD movie disks are UDF format, but not much else is.
    -Doug

  • My server keeps telling me that I have an update for 10.10.1 and that I should look for it in the app store. I do that and am not finding anything that makes the update notification go away. I have installed an update the app store says I need.

    I updated to Yosemite on my Mac mini/server. Then my server wouldn't work. I updated and bought the software needed when updating to Yosemite. The server seems to be working. Subsequently I've started getting a notification on the server icon that an update is needed. When i look for details I'm instructed to go to the app store. I've done that. In the updates category no update is found by the app store system. I then went to the purchases category and was informed I needed to install the server software I'd purchased. While I'd installed before, I did it again. I still have the 1 in a red circle covering part of the server icon. I have restarted the mac mini. I can't figure out what step I'm missing. The continued presence of the red circle suggests that the software still isn't installed. Looked into restarting the server in help but don't find clear instructions that make sense. Suggestions from someone who has a mac mini server and has worked with this topic would be greatly appreciated. General comments from anyone who has not looked at this kind of problem before might turn out to be unenlightening for this neophyte.

    I tried turning the computer off and then back on. The alerts don't show the notice to update as resolved. Hopefully this is not a problem or an indicator or another problem. Should I ignore or reload 10.10.1 from the app store to trigger a resolved check in a green circle?
    Interesting that I had to buy server software after my free Yosemite download. I would have hoped that the two pieces of software would have gone together without any complication. It is not positive to end up buying a problem. Ah well, time to move on.

  • I have my iTunes library on an external HD because it is too big for my iMAC 500GB HD. I want to backup my external HD. Can I do this with any Apple cloud product or should I look elsewhere? Also is it worth just buying another external HD to back up

    I have my iTunes library on an external HD because it is too big for my iMAC 500GB HD. However, it is not backed up, so I need a solution to backup my external HD. Can I do this with any Apple cloud product or should I look elsewhere for cloud products? Will it be cheaper/easier just to buy another external HD to back up my existing external HD? Thanks

    I don't know if this is me adding files to iTunes when the external wasn't connected
    it is.
    is it OK to just keep deleting that library on the Air?
    i wouldn't - at least not until i
    mount the external
    point iTunes media folder location back to the external via preferences > advanced
    consolidate my library via file > library > organize library
    The ntfs hasn't seem to be causing any problems, but I've always wanted to know.
    in order for your Mac to write to NTFS drives, it needs some help by installing e.g. the NTFS 3G driver. apparently that or something similar is installed on your Mac already. preferably, it would be formatted for Mac but then windows machines would need to have e.g. MacDrive installed to recognize the drive.

  • My husband got a new ipad and set up his apple id without looking into the implications of that.  Now I want to sync this ipad with our itunes so we can access it on here, but our itunes has a different apple id.  Any way to do this?

    My husband got a new ipad and set up his own apple id without looking into the implications of that.  Now I want to sync this ipad with our itunes so we can access it on here, but our itunes has a different apple id.  Any way to do this?

    You should be able to accept this message, it will cause existing music, photos (not camera roll) and videos (also excluding those in camera roll) to be removed and replaced with those from this computer. All other user data on the iPad will be unaffected.

Maybe you are looking for