Hi everybody,
I have an indesign file in the folder, such as the folder name is “MyFolder” and indesign name is “123”. How do I make indesign file name change to folder name?
Thank you!
Hi everybody,
I have an indesign file in the folder, such as the folder name is “MyFolder” and indesign name is “123”. How do I make indesign file name change to folder name?
Thank you!
This goes for all files.
set myFile to choose file with prompt "Choose the Indesign file"
set fileInfo to (info for myFile)
set fileExtension to name extension of fileInfo
set fileName to name of fileInfo
if fileExtension is not missing value then set fileName to (characters 1 thru ((count every character of fileName) - (count every character of fileExtension) - 1)) of fileName
set fileName to fileName as string
tell application "Finder" to set name of (container of myFile) to fileName
Hope it helps,
ief2
ief2,
Thank you for your reply!
However, I would like to Indesign file name change to Folder name. For example: “123”. Indd change to “MyFolder”. Indd
Hi,
Try this:
set myFolder to (choose folder with prompt "Choose the Folder")
tell application "Finder"
set folderName to name of myFolder
set folderName to folderName as string
set theFiles to files in myFolder
repeat with aFile in theFiles
set filename to name of aFile
set filename to filename as string
set name of aFile to folderName & "_" & filename
end repeat
end tell
I placed the folder name before the filename incase there is more than one file in the folder
–Peter–
or this:
set myFile to choose file with prompt "Choose the Indesign file"
tell application "Finder"
set fileInfo to (info for myFile)
set fileExtension to name extension of fileInfo
set filename to name of fileInfo
if fileExtension is not missing value then
set name of myFile to name of (container of myFile) & "." & fileExtension
else
set name of myFile to name of (container of myFile)
end if
end tell
–Peter–
Thanks Peter!
That’s great!
Okay,
If there’s anything else, feel free to ask me.
–Peter