Remove numbers in front of file[working] + append number to duplicate filenames[not-working]
Hi all,
I have an AppleScript which removes any numbers and/or hyphens and underscores from the beginning of a filename. Thats works fine.
However, sometimes i might have a situation like this:
Filename Eg;, 01-Dog.jpg, 02-Dog.jpg, 03-Dog.jpg, etc.
In such a case, the script stops/does not run, only telling me that there already is a file with that name. It does not tell me which file its conflicting with (sometimes there are ALOT of files to look through).
Could somebody please help in modifying this script so that in such a case, a file with the same name would have a number OR letter appended to the end of a filename (before the extension).
Eg;, Dog2.jpg, Dog3.jpg, etc.
on run {input, parameters} repeat with thisFile in input tell application "Finder" set filename to name of (thisFile as alias) set filename to (do shell script "echo " & quoted form of filename & " | sed 's/^[0-9_-]*//'") set name of thisFile to filename end tell end repeat return input end run
Thank you for your help!!
If anyone should be interested in such a script, @jweaks helped me out on StackOverflow
Similar Messages
-
PSE9: Using File/Move; what happens with duplicate filenames
I have PSE9 on Win7.
I'd like to use File/Move to move a large number of images from one set of folders to a another location.
The new location would be a single folder.
I'm pretty confident that I have duplicate filenames. So the same filename exists in more than one
of my 'source' folders.
Using File/Move what is going to happen when I encounter these duplicates?
Thanks for any help or advice.So I used a belt and supenders method of organization. Tags and folders.
Oh, how I hate that phrase. This has sent many people down the road of organizing two different ways, with a cost. You did twice as much work. And in my opinion, using two different ways to organize was totally unnecessary, and waste of effort.
But in all honesty I don't use a lot of the advanced features of PSE. So from time to time
Neither do I. But that is irrelevant to how your set things up so you can find your photos when you want them.
For my new downloads, I believe I will just put them all into a single 'My Pictures' folder.
Unless your version of PSE has more features than mine does, putting them into a single folder (without subfolders by capture date) is more work than using the default folder naming scheme, which is capture date! And it buys you nothing! There is absolutely no harm in using the default of putting photos in folders by capture date. Don't make extra work for yourself! Now if your version lets you put all your new photos into a single large folder ...
I read some web articles that gave me the impression that there might be another way to migrate rather
than Backup/Restore.
Not sure what you read. You could manually transfer all your photos AND catalog file from one computer to another, and if you get all the details right, everything still works! But the onus is on you to get all the details right.
It sounded like after writing all the metadata those images could be File/Get Photos... intoPSE. But I also saw there may be a need to use the Keyword Tags/+/Save Keyword Tags to File function as well.
Writing metadata to files does not let you rebuild your catalog completely. There is information in your catalog that will never be written to the files themselves. In fact, writing metadata to the photo files was NEVER intended to be a backup method; it was intended to be a method to allow PSE to communicate SOME information with other applications (like Flickr). So, should you want to make a backup, metadata is not the way to go. If you want multiple backup approaches, use the PSE method, and also make copies of your catalog file and photos using some other automated method.
I used the File/ 'Write Keywords and Properties... ' function to write all the metadata back into all of my files.That seems like a good idea because I use multiple file backup approaches. Is there a way to get
PSE to always write that info into a file anytime it changes? Like when I'm adding a tag?
There is no way to automate this. -
My ASP csv download page is calling:
Response.Clear
Response.AddHeader "content-disposition","attachment; filename=filename.csv"
Response.ContentType = "Content-Type: text/csv; charset=utf-8"
When I click on the link to this ASP page the Firefox "Opening filename.csv" dialog appears:
filename.csv
which is a: Text Document
If I choose "Open with <Any Application name>" the file is always opened by the application with a .txt appended to the filename, which in this particular case prevents my spreadsheet software from correctly opening it.
a) How do I prevent the .txt being appended to the file name if OpenWith is used?
b) Is there a way to add a CSV type to the Tools->Options Applications Content Type list to prevent the "which is a: Text Document" message?
This behaviour does not happen in Chrome, Opera, Safari or IE.Is there no entry in Application Options for text/csv?
orange Firefox button ''or'' classic Tools menu > Options > Applications
In the search box, type csv and pause while Firefox filters the list.
If you have Microsoft Office installed, the dialog typically lists "Microsoft Office Excel Comma Separated Values File (text/csv)" (you need to display the mouseover tooltip to see all of it).
I assume Firefox extracts this information from the registry. If you want to reset the Application Options and have Firefox rebuild them, the method is described in this article:
https://support.mozilla.org/en-US/kb/cant-download-or-save-files#w_reset-download-actions-for-all-file-types ("Reset download actions for all file types") -
I have an ID-book made out of 10 InDesign documents. Everything is fine, but one thing.
One of the chapters (#4) is made out of two ID documents: "chapter4a.indd“ and "chapter4b.indd". The chapter number, which is automatically given by the book, is correct: 4. But the numbering of the next below level (4.x) is wrong. In the file „chapter4a.indd“ I have the sub-chapters 4.1, 4.2 and 4.3. But in the „chapter4b.indd“ it starts yet again with 4.1 instead of 4.4.
Where is the mistake?
Merging the two ID files "chapter4a.indd“ and "chapter4b.indd" into one is not an option, unfortunately.
Is it possible to let the sublevel chapter number (4.x) continue after the ID-document change or does it start always at ".1" once again because it's in a new document?
Thanks for any help!Thanks Peter for your reply.
But why should it be possible to let the chapter number continue after a document cross, while the sub level number is not passed on the the next doc? If I am still in the same chapter, the sub level numbers continue.
And plus, what whould be the advantage of an automatic ( ! ) chapter numbering when the sub chapter numbering would have to be fixed manually?
To have either both or none would be logical, wouldn't it? -
Add/Remove Programs - export to text file?
Hello,
I am wondering if it is possible to export a list of everything in add/remove programs to a text file for inventory purposes.
I have not found any easy method to do this short of copying reg files or installer 3rd party software. Since the idea is to save time neither of those are viable solutions.
Does anyone have any ideas?
-JustinYou could try this vbs script that lists installed programs and add info to a text file.
Michael Petersen
Option Explicit
Dim sTitle
sTitle = "InstalledPrograms.vbs by Bill James"
Dim StrComputer
strComputer = InputBox("Enter I.P. or name of computer to check for " & _
"installed software (leave blank to check " & _
"local system)." & vbcrlf & vbcrlf & "Remote " & _
"checking only from NT type OS to NT type OS " & _
"with same Admin level UID & PW", sTitle)
If IsEmpty(strComputer) Then WScript.Quit
strComputer = Trim(strComputer)
If strComputer = "" Then strComputer = "."
'Wscript.Echo GetAddRemove(strComputer)
Dim sCompName : sCompName = GetProbedID(StrComputer)
Dim sFileName
sFileName = sCompName & "_" & GetDTFileName() & "_Software.txt"
Dim s : s = GetAddRemove(strComputer)
If WriteFile(s, sFileName) Then
'optional prompt for display
If MsgBox("Finished processing. Results saved to " & sFileName & _
vbcrlf & vbcrlf & "Do you want to view the results now?", _
4 + 32, sTitle) = 6 Then
WScript.CreateObject("WScript.Shell").Run sFileName, 9
End If
End If
Function GetAddRemove(sComp)
'Function credit to Torgeir Bakken
Dim cnt, oReg, sBaseKey, iRC, aSubKeys
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
sComp & "/root/default:StdRegProv")
sBaseKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oReg.EnumKey(HKLM, sBaseKey, aSubKeys)
Dim sKey, sValue, sTmp, sVersion, sDateValue, sYr, sMth, sDay
For Each sKey In aSubKeys
iRC = oReg.GetStringValue(HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oReg.GetStringValue HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then
iRC = oReg.GetStringValue(HKLM, sBaseKey & sKey, _
"DisplayVersion", sVersion)
If sVersion <> "" Then
sValue = sValue & vbTab & "Ver: " & sVersion
Else
sValue = sValue & vbTab
End If
iRC = oReg.GetStringValue(HKLM, sBaseKey & sKey, _
"InstallDate", sDateValue)
If sDateValue <> "" Then
sYr = Left(sDateValue, 4)
sMth = Mid(sDateValue, 5, 2)
sDay = Right(sDateValue, 2)
'some Registry entries have improper date format
On Error Resume Next
sDateValue = DateSerial(sYr, sMth, sDay)
On Error GoTo 0
If sdateValue <> "" Then
sValue = sValue & vbTab & "Installed: " & sDateValue
End If
End If
sTmp = sTmp & sValue & vbcrlf
cnt = cnt + 1
End If
Next
sTmp = BubbleSort(sTmp)
GetAddRemove = "INSTALLED SOFTWARE (" & cnt & ") - " & sCompName & _
" - " & Now() & vbcrlf & vbcrlf & sTmp
End Function
Function BubbleSort(sTmp)
'cheapo bubble sort
Dim aTmp, i, j, temp
aTmp = Split(sTmp, vbcrlf)
For i = UBound(aTmp) - 1 To 0 Step -1
For j = 0 to i - 1
If LCase(aTmp(j)) > LCase(aTmp(j+1)) Then
temp = aTmp(j + 1)
aTmp(j + 1) = aTmp(j)
aTmp(j) = temp
End if
Next
Next
BubbleSort = Join(aTmp, vbcrlf)
End Function
Function GetProbedID(sComp)
Dim objWMIService, colItems, objItem
Set objWMIService = GetObject("winmgmts:\\" & sComp & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select SystemName from " & _
"Win32_NetworkAdapter",,48)
For Each objItem in colItems
GetProbedID = objItem.SystemName
Next
End Function
Function GetDTFileName()
dim sNow, sMth, sDay, sYr, sHr, sMin, sSec
sNow = Now
sMth = Right("0" & Month(sNow), 2)
sDay = Right("0" & Day(sNow), 2)
sYr = Right("00" & Year(sNow), 4)
sHr = Right("0" & Hour(sNow), 2)
sMin = Right("0" & Minute(sNow), 2)
sSec = Right("0" & Second(sNow), 2)
GetDTFileName = sMth & sDay & sYr & "_" & sHr & sMin & sSec
End Function
Function WriteFile(sData, sFileName)
Dim fso, OutFile, bWrite
bWrite = True
Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set OutFile = fso.OpenTextFile(sFileName, 2, True)
'Possibly need a prompt to close the file and one recursion attempt.
If Err = 70 Then
Wscript.Echo "Could not write to file " & sFileName & ", results " & _
"not saved." & vbcrlf & vbcrlf & "This is probably " & _
"because the file is already open."
bWrite = False
ElseIf Err Then
WScript.Echo err & vbcrlf & err.description
bWrite = False
End If
On Error GoTo 0
If bWrite Then
OutFile.WriteLine(sData)
OutFile.Close
End If
Set fso = Nothing
Set OutFile = Nothing
WriteFile = bWrite
End Function
Deploy deploy deploy -
Numbers 3.0.1 - Can't open file "Work.numbers"
Hello, all Community!
Here's a iWork Numbers file, edited and successful saved yesterday to local folder, named Work.numbers.
Today this file not opening anymore. Number's says: "Can't open file ..." And just one button "OK".
In system log here's next lines:
iTrancemind # tail -F /var/log/system.log | grep Numbers
Dec 30 17:31:23 iTrancemind.local Numbers[2446]: *** Error: -[TSPReader runReferenceCompletions] TSPReader.mm:564 No object unarchived for identifier 3022
Dec 30 17:31:23 iTrancemind.local Numbers[2446]: *** Error: -[TSPReader runReferenceCompletions] TSPReader.mm:564 No object unarchived for identifier 3019
Dec 30 17:31:23 iTrancemind.local Numbers[2446]: *** Error: -[TSPReader runReferenceCompletions] TSPReader.mm:564 No object unarchived for identifier 468721
Dec 30 17:31:23 iTrancemind.local Numbers[2446]: *** Error: -[TSPReader runReferenceCompletions] TSPReader.mm:564 No object unarchived for identifier 3022
Dec 30 17:31:23 iTrancemind.local Numbers[2446]: *** Assertion failure #1: __97-[TSPObjectContext readWithReadCoordinator:finalizeHandlerQueue:rootObject:error:readCompletion:]_block_invoke TSPObjectContext.mm:1129 Could not read document object with error: Error Domain=com.apple.iWork.TSPersistence Code=1 "Произошла ошибка при чтении документа." UserInfo=0x600001069600 {NSLocalizedDescription=Произошла ошибка при чтении документа., TSULocalizedErrorAlertTitle=Произошла ошибка при чтении документа.}
Dec 30 17:31:23 iTrancemind.local Numbers[2446]: *** Assertion failure #2: -[TSADocumentRoot dealloc] TSADocumentRoot.mm:246 Someone neglected to call -willClose on the document before releasing it.
Dec 30 17:31:23 iTrancemind.local Numbers[2446]: *** Assertion failure #3: -[TSADocumentRoot dealloc] TSADocumentRoot.mm:246 Someone neglected to call -willClose on the document before releasing it.
What I done to try resolve this problem:
1. Checked permissions and repaired.
2. Tried to open file in iCloud web-editor - no result. iCloud says that it can't open this spreadsheet.
3. Tried to convert file via some online file type converters to xls document (i will not put link here). Converter says that I have wrong file format.
Also I tried to open file in some other programs. No luck.
That's all.
File Work.numbers has been closed correctly and was no errors. Unfortunately, we have no any backup copy of this file anywhere. I know, this is stupid, but question now: How can I repair this document? Is any repair tools for iWork files?
The file seems like has right structure.
iTrancemind # ls -la Work.numbers/
total 4776
drwxr-xr-x@ 8 max staff 272 30 дек 16:44 .
drwx------+ 19 max staff 646 30 дек 17:53 ..
drwxr-xr-x@ 2 max staff 68 30 дек 00:28 Data
-rw-rw-rw-@ 1 max staff 2306978 30 дек 00:28 Index.zip
drwxr-xr-x 5 max staff 170 30 дек 14:47 Metadata
-rw-r--r--@ 1 max staff 1690 30 дек 00:31 preview-micro.jpg
-rw-r--r--@ 1 max staff 13602 30 дек 00:31 preview-web.jpg
-rw-r--r--@ 1 max staff 112911 30 дек 00:31 preview.jpg
Unzipping Index.zip is passing without errors. It has many "iwa" files with binnary content and I can't get data from it. But, data in that file is very important for one person.
Could anybody help me to resolve my problem to restore Numbers document?Hi rabg,
I am using OS X 10.8 on a Mac. This may be different if you are using iOS.
Does Numbers'09 still exist in your Applications folder? Maybe inside a new folder? Perhaps you could use Numbers'09 to open your documents.
Regards,
Ian. -
How do I remove or delete files and image files within a document foler? I have tried dragging the files to the trash, but that is not working.
Right-click (or ctrl-click) on a file. If the "move to Trash" option is greyed out, select "get info" and read the permissions at the bottom of the info window.
Wat are they?
Do the same for the enclosing folder - what permissions does that have? -
I bought Numbers because my Excel files would not work with Mavericks. How can I import a non-functioning Excel file into numbers? (As of now, the file NAME transfers but data does not.)
HI Dave,
I'm surprised you get no message when you attempt opening the Excel document in Numbers.
I'm assuming Numbers 3.1, since you are running Mavericks.
Does the Numbers file that opens show any content?
Does it contain a table?
How large?
Does it contain more than one tab (indicating more than one sheet)?
Do those other tabs contain a table?
Have you checked those tables for data content?
There have been cases in the past of imported documents opening with white text on a white background, giving the appearance of containing nothing. Check for this by selecting a block of cells, then applying a Fill colour or a Text colour using the Format button (paintbrush).
I'd also suggest attempting to open the Excel files using LibreOffice, which can be downloaded from the linked website.
Regards,
Barry -
Time Machine remove all backups of this files not working
I've just left a company that had me use my MB as a BOYD...now I have to remove all of their stuff, including files held by Time Machine.
I selected their directory in TM and said "remove all backups of this file". It asked for my password and seemed to accept it.
And then nothing happened. I've left the MB plugged in, with my Seagate drive plugged in (by usb), untouched for 48 hours. Even though there is no other activity on the machine TM keeps says that its doing multi-gig backups. And yet, the files I've asked it to remove remain in my various TM backups.
I've heard that TM can be unbelievably slow....is 48 hours not long enough? My MB has 128 gig and my TM has 500 gig so this is not a lot of data.
Suggestions?Best bet would be log problem on apples support and then set up call with support - particularly if most of the backup is not your stuff - but you want to keep your stuff.
Time Machine Cleanups don't match the length of the backup - because of collapsing of daily files into weekly files - and the hourly ones into daily.
Have you opened Time Machine desktop drive to look at the folder and see what is going on -- you should have daily backups for the last month (in days) and weekly backups back to the beginning. With the delete all of some files that may be an issue where that is the only set of files that changed in that week (if you chose not to back up system files).
Just to be sure - you are running Apples Time Machine and not the backup that came with the Seagate drive? -
Remove numbers after filename and add custom sequence?
Hi,
I have to rename quite much of rendered frames which names are like aoPass_000001.png...aoPass_099999.png. I have to replace those numbers to start from 0111111 for example witch I'll input manually when I run rename process. Right now I do it using Automator's Make Sequential and writing new name for it and giving new starting number. Yes, it's doable, but must be some better way to do?
Also I have few different passes so file structure is like:
- renderPasses
- alphaPass
- aoPass
- beautyPass
So I'd like to run for all sub folders at once if possible. They all do share same sequence numbers so maybe remove 6 characters from end might work keeping front side untouched.
Doable with combinations of Automator or should I learn some Apple script...?
Thanks!Applescript and Automater are discussed in Mac OS X Technologies
I'll see if a host will move this. -
front page opens works shortly freezes.
only yellow green buttons work. I click yellow to minimize normal top bar menu appears I choose new page, opens works normally.
The restart saved tabs does not work on that first page.Hi @prdstudio3 ,
Thank you for visiting the HP Support Forums. The Serial Number needed to be removed from your Post. This is From our Rules of Participation:
Protect privacy - yours and others'. Don't share anything about yourself that you would not want to see on a road-side billboard. Don't post contact or other personal information-your own or anyone else's-or any content that you receive in one-to-one communications without the author's consent. For example, don’t post your computer’s serial # or contact information publicly, and do not allow someone you don’t know to remotely take control of your computer.
If you need people to contact you directly, either ask them to send you a private message or subscribe to the thread so you will be notified when there are replies. You may also click on your name anywhere in the forum and you will be taken to your profile page, where you can find a list of threads you have participated in.
Sharing personal email addresses, telephone numbers, and last names is not allowed for your safety. If you have any questions feel free to send me a private message in reply.
Thank you
George
I work for HP -
How can I make a .gif file work in Keynote on my iPad Mini?
How can I make a .gif file work in Keynote on my iPad Mini?
Have saved a .gif file to my Camera Roll, and it works fine as I have checked it through mail. When I import it into Keynote however it won't animate. Even when I play slide. Any suggestions?The can use apps such as Apple's Pages app for Word documents and Numbers for Excel spreadsheets, and from third-parties apps such as Documents To Go ('premium' version) and QuickOffice Pro HD.
-
After upgrading to Mountain Lion, I cannot open my File Maker Pro files. Can I use Numbers to open these files?
Numbers is a spreadsheet program and FileMaker is a database program, so you probably can't use Numbers to open them unless you had first exported them from FileMaker in a spreadsheet-compatible format.
If you upgraded from 10.6 Snow Leopard or earlier and your old copy of FileMaker won't open anymore, it might be a PowerPC application that is not compatible with 10.7 and later. If that is the case, to work with your FileMaker files you should upgrade your copy of FileMaker to the latest version, which seems to be FileMaker 12. -
I recently Updated my phone and my front camera stopped working its pitch black but still shows the icons on the screen but when i get off the app and get back on and flip the camera to my face view it works fine
Hi there Fgonzalez2015,
You may find the camera troubleshooting steps in the article below helpful.
Get help with the camera on your iPhone, iPad, or iPod touch
You see a closed lens or black screen
If you see a closed lens or black screen when you open the Camera app, try these steps:
Make sure that there’s nothing blocking the camera lens. If you’re using a case, try removing it.
Force the app to close, then open the Camera app again.
Restart your device, then open the Camera app again.
If your device has a front and rear camera, try both cameras by tapping the camera swap icon . If you see the closed lens or black screen on only one camera, take your device to an Apple Retail Store or Authorized Service Provider for more help.
-Griff W. -
File Copy to local attached Firewire "LaCie" not working any longer
Dear all,
have Updated my Mac Book to the latest 10.6.3 Release and since following is not longer working:
Copying from FinalCutPro created Quicktime *.mov Files from the internal HD via Finder to the Firewire Drive - Error Message "Der Vorgang konnte nicht abgeschlossen werden, da das Objekt „filename.mov“ in Verwendung ist."
The File is definitive not in use (I also tried it with a Copy of it - same behavior). I have tried this further with different File(sizes) - it starts copying and stops always at different timing afterwards with the same Error. Can also delete this file without any errors.
Having seen that this has also happened by some others in this forum by writing back to SMB - so removed extented attributes which seems to work with them - still no success for me.
Any ideas?
Many thanks
/JuergenSome Update on this - Copying to another FireWire 800 attached Drive with Apple Filesystem worked. But I am still guessing what happened
Maybe you are looking for
-
Macbook Pro mid 2012 15" Freezing Inconsistently
I've had quite an ordeal with my Macbook Pro over the last few years, so this will be a lengthy question, sorry in advance. Let me get right to it. Backstory: I bought my MBP 15" new in summer of 2012. I had 8GB of laptop ram that had been in my moth
-
Problems with the Calendar App in iPhone 4S
I'm having a problem the Calendar app with an iPhone 4S (iOS 6.1.3). I added a Google account with the company's domain (Microsoft Exchange option), but the calendar it's not available on the Calendar App list. I already tried to delete / restart / c
-
I'm new to the Eclipse platform and I'm trying to publish a Crystal Report to our Enterprise Repository. As I understand from the documentation for Crystal Reports for Eclipse, I should be able to go to Window>Show View> Other, expand the Crystal Re
-
Aggregate exported data in /CPMB/EXPORT_TD_TO_FILE
is it possible to aggregate results data in chain /CPMB/EXPORT_TD_TO_FILE? One of my packages uses this chain - it exports several fields from BPC model. Model has 8 dimension, but only 4 are used in export process - it causes many combinations are r
-
Hi, I am working on one web dynpro application where I am using function module : Bapi_Employee_Getdata . In this i need to get the user id from portal and need send that as input parameter to RFC, I did everything but when i see output i c