Author Topic: Variable to remove spaces?  (Read 14001 times)

Offline gajones

  • Member
  • **
  • Posts: 61
    • View Profile
Variable to remove spaces?
« on: May 10, 2006, 09:10:29 AM »
I use variables to rename my files (usually 'object'). However this often creates filenames with spaces, which some of the FTP servers for the British newspapers (notably the Daily Mirror) won't accept, giving an 'Invalid Filename Error'.

How about being able to add something to the variable, eg {object_rmsp} so that the spaces would be replaced by underscores?

Offline dbrouse

  • Full Member
  • ***
  • Posts: 190
    • View Profile
    • DC Corporate Headshots
Re: Variable to remove spaces?
« Reply #1 on: May 10, 2006, 09:28:21 AM »
The "object" variable only has the space becuase you created it...probably by mistake (space at end of word, or beterrn words instead of an underscore). When you finish typing the name, can you simply backspace to make sure there is no extra space?

dbr
Delane B. Rouse/Rouse Photography Group, LLC
Mac OS: Version 10.7.4, Build 12713

Online Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20524
    • View Profile
    • Camera Bits, Inc.
Re: Variable to remove spaces?
« Reply #2 on: May 10, 2006, 09:30:51 AM »
I use variables to rename my files (usually 'object'). However this often creates filenames with spaces, which some of the FTP servers for the British newspapers (notably the Daily Mirror) won't accept, giving an 'Invalid Filename Error'.

How about being able to add something to the variable, eg {object_rmsp} so that the spaces would be replaced by underscores?

Then we would need to have _rmsp for every variable that represents a field that a user can type into.  How about using the Fine and Replace dialog to find a space and replace it with an underscore?  I haven't tried it just now, but give that a shot.

HTH,

-Kirk

Offline gajones

  • Member
  • **
  • Posts: 61
    • View Profile
Re: Variable to remove spaces?
« Reply #3 on: May 10, 2006, 09:51:11 AM »
What I'm trying to achieve is to preserve the spaces in the IPTC, but remove them in the filenames. I've been using a freeware tool called R-Name to do this but just wanted a more integrated way of doing it for the less technically-minded people in our office...

Online Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20524
    • View Profile
    • Camera Bits, Inc.
Re: Variable to remove spaces?
« Reply #4 on: May 10, 2006, 03:35:31 PM »
What I'm trying to achieve is to preserve the spaces in the IPTC, but remove them in the filenames. I've been using a freeware tool called R-Name to do this but just wanted a more integrated way of doing it for the less technically-minded people in our office...

I think it would be good to just have an option to replace/remove spaces in names during FTP transfer, then you don't have to change them on your local filesystem.

How does that sound?

-Kirk

Offline gajones

  • Member
  • **
  • Posts: 61
    • View Profile
Re: Variable to remove spaces?
« Reply #5 on: May 10, 2006, 09:18:29 PM »

I think it would be good to just have an option to replace/remove spaces in names during FTP transfer, then you don't have to change them on your local filesystem.

How does that sound?

That sounds like a good solution, although we actually use Transmit rather than PM to FTP the images...

Online Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20524
    • View Profile
    • Camera Bits, Inc.
Re: Variable to remove spaces?
« Reply #6 on: May 10, 2006, 09:26:41 PM »

I think it would be good to just have an option to replace/remove spaces in names during FTP transfer, then you don't have to change them on your local filesystem.

How does that sound?

That sounds like a good solution, although we actually use Transmit rather than PM to FTP the images...

Why?

-Kirk

Offline gajones

  • Member
  • **
  • Posts: 61
    • View Profile
Re: Variable to remove spaces?
« Reply #7 on: May 11, 2006, 04:41:43 PM »

I think it would be good to just have an option to replace/remove spaces in names during FTP transfer, then you don't have to change them on your local filesystem.

How does that sound?

That sounds like a good solution, although we actually use Transmit rather than PM to FTP the images...

Why?

-Kirk

A couple of reasons - some of our clients use sftp, and also Transmit seems more robust if transfers stall or need to be cancelled. The queue also gives  visual feedback as to which server the images are going - useful when you have to send to 20 servers as we do every day.

Gareth

Online Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20524
    • View Profile
    • Camera Bits, Inc.
Re: Variable to remove spaces?
« Reply #8 on: May 11, 2006, 05:02:47 PM »

I think it would be good to just have an option to replace/remove spaces in names during FTP transfer, then you don't have to change them on your local filesystem.

How does that sound?

That sounds like a good solution, although we actually use Transmit rather than PM to FTP the images...

Why?

A couple of reasons - some of our clients use sftp, and also Transmit seems more robust if transfers stall or need to be cancelled. The queue also gives  visual feedback as to which server the images are going - useful when you have to send to 20 servers as we do every day.

We don't yet have secure FTP.  The latest version should cancel much better since we added non-blocking socket communication.

What kind of visual feedback does Transmit give?

As for your original problem, eliminating spaces from filenames, I think if I were to add Find and Replace on filenames, you could find spaces and replace them with '_' which would solve your problem.

In the meantime, you could put the filename into an unused IPTC field by using the {filenamebase} variable in the IPTC Stationery Pad, and then you could Find and Replace a space with _ in only that previously unused field.  Then you could batch rename using that IPTC field.  Then if you want that field to be blank again you could apply the IPTC Stationery Pad again to clear out that IPTC field.

Example:

Unused field is "Edit Status:"  Select all of the images you want to work on.  Open up IPTC Stationery Pad.  Set the check on the Edit Status field.  In the Edit Status field put: {filenamebase}
Click on the Apply Stationery to Selected button.  Close the IPTC Stationery Pad dialog.
Open up the Find and Replace panel (Edit->Find and Replace).  In the Find: field enter a single space.  In the Replace: field enter a single _ (underscore.)  Set only the Edit Status checkbox.  Do the Replace.  Close the Find and Replace panel.
Rename the photos (File->Rename Photos...) entering {editstatus} in the renaming string text field.  Click the Rename button.
If you want to clear out the Edit Status field, you can open up the IPTC Stationery Pad again, clear out the Edit Status field, and make sure that its checkbox is set.  Then click on the Apply Stationery to Selected button.

It's a roundabout way of doing what could be done in one step with a Find and Replace with filenames but it will work fine.

HTH,

-Kirk

Offline gajones

  • Member
  • **
  • Posts: 61
    • View Profile
Re: Variable to remove spaces?
« Reply #9 on: May 11, 2006, 06:53:35 PM »


What kind of visual feedback does Transmit give?

As well as listing the filename, it shows the name of the server that it is sending to.

Quote
As for your original problem, eliminating spaces from filenames, I think if I were to add Find and Replace on filenames, you could find spaces and replace them with '_' which would solve your problem.

In the meantime, you could put the filename into an unused IPTC field by using the {filenamebase} variable in the IPTC Stationery Pad, and then you could Find and Replace a space with _ in only that previously unused field.  Then you could batch rename using that IPTC field.  Then if you want that field to be blank again you could apply the IPTC Stationery Pad again to clear out that IPTC field.

Example:

Unused field is "Edit Status:"  Select all of the images you want to work on.  Open up IPTC Stationery Pad.  Set the check on the Edit Status field.  In the Edit Status field put: {filenamebase}
Click on the Apply Stationery to Selected button.  Close the IPTC Stationery Pad dialog.
Open up the Find and Replace panel (Edit->Find and Replace).  In the Find: field enter a single space.  In the Replace: field enter a single _ (underscore.)  Set only the Edit Status checkbox.  Do the Replace.  Close the Find and Replace panel.
Rename the photos (File->Rename Photos...) entering {editstatus} in the renaming string text field.  Click the Rename button.
If you want to clear out the Edit Status field, you can open up the IPTC Stationery Pad again, clear out the Edit Status field, and make sure that its checkbox is set.  Then click on the Apply Stationery to Selected button.

It's a roundabout way of doing what could be done in one step with a Find and Replace with filenames but it will work fine.

HTH,

-Kirk


Thanks for that suggestion Kirk.

As we seem to have wandered onto the topic of FTP, I have one more thought for you. How about being able to show FTP connections in the Favourites pane? Each FTP connection would be represented by a folder, onto which you could drop images to add them to the queue. You could also create FTP groups (folders containing more than one FTP connection). Then you could drop the images onto an FTP Group Folder, and have PM queue them up and send them to all the FTP connections in that folder.

Sending the same images to multiple servers is something we do every day, so this could help simplify and speed up the process.

Online Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20524
    • View Profile
    • Camera Bits, Inc.
Re: Variable to remove spaces?
« Reply #10 on: May 11, 2006, 07:31:57 PM »
What kind of visual feedback does Transmit give?
As well as listing the filename, it shows the name of the server that it is sending to.

Since our progress window already shows the name of the file being sent (it's at the top), how about we change the title of the window to either the connection name or the server name?  Would that be enough?

Quote from: gajones
As we seem to have wandered onto the topic of FTP, I have one more thought for you. How about being able to show FTP connections in the Favourites pane? Each FTP connection would be represented by a folder, onto which you could drop images to add them to the queue. You could also create FTP groups (folders containing more than one FTP connection). Then you could drop the images onto an FTP Group Folder, and have PM queue them up and send them to all the FTP connections in that folder.

Sending the same images to multiple servers is something we do every day, so this could help simplify and speed up the process.

I was thinking of instead of just the connection (which doesn't tell us much) I was thinking of making the "snapshots" (lightning button) from various dialogs be able to be put in the Favorites, and then when files are dragged and dropped onto them then they would execute as if you opened up the dialog that they correspond to and then pressed the "go" button (Save, Send, Export, Print, etc.)

So you could have a setting that uploaded to a particular server's folder, converting to JPEG, watermarking, renaming, etc. just by dragging and dropping a few files onto the "snapshot favorite".

To extend your idea, you could create a folder full of Snapshot Favorites and when you drop files onto the folder the files get processed by each Snapshot Favorite in the folder.  This extension could get rather complicated to develop because not all operations are queued like FTP or PhotoShelter.

I think any or all of this could be pretty powerful.

Thanks for the feedback,

-Kirk

Offline gajones

  • Member
  • **
  • Posts: 61
    • View Profile
Re: Variable to remove spaces?
« Reply #11 on: May 12, 2006, 10:50:31 AM »
Quote from: Kirk Baker

Since our progress window already shows the name of the file being sent (it's at the top), how about we change the title of the window to either the connection name or the server name?  Would that be enough?


I think it would be preferable to have another column in the queue showing the connection name. This is because when you're sending to a lot of servers it's useful to be able to check at a glance that you haven't omitted any servers or are sending to one by mistake. A list of filenames does not give you that information.

To beef up the queue, what would be really useful would be if you could show/hide the list of transfers to each server.  Therefore, the unexpanded queue would just list the connection names and the progress. eg "Sending 3 of 29", or "21 files queued for sending". That way you could see at a glance how much has transferred for each server and what is still to go, without having to scroll down a long list.

Quote from: Kirk Baker
I was thinking of instead of just the connection (which doesn't tell us much) I was thinking of making the "snapshots" (lightning button) from various dialogs be able to be put in the Favorites, and then when files are dragged and dropped onto them then they would execute as if you opened up the dialog that they correspond to and then pressed the "go" button (Save, Send, Export, Print, etc.)

So you could have a setting that uploaded to a particular server's folder, converting to JPEG, watermarking, renaming, etc. just by dragging and dropping a few files onto the "snapshot favorite".

To extend your idea, you could create a folder full of Snapshot Favorites and when you drop files onto the folder the files get processed by each Snapshot Favorite in the folder.  This extension could get rather complicated to develop because not all operations are queued like FTP or PhotoShelter.

I think any or all of this could be pretty powerful.

Thanks for the feedback,

-Kirk


Sounds like an excellent idea.

thanks

Gareth.

Offline gajones

  • Member
  • **
  • Posts: 61
    • View Profile
Re: Variable to remove spaces?
« Reply #12 on: May 18, 2006, 08:06:35 PM »
I just remembered one more reason why we use Transmit for FTP - it allows you to export a file containing all the stored connections and passwords, which you can import on another machine.

Online Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 20524
    • View Profile
    • Camera Bits, Inc.
Re: Variable to remove spaces?
« Reply #13 on: May 18, 2006, 08:56:35 PM »
I just remembered one more reason why we use Transmit for FTP - it allows you to export a file containing all the stored connections and passwords, which you can import on another machine.

That wouldn't be hard to add.  In fact, we could do a lot to export even more preferences than we currently do.  Some preferences like paths to applications for editing or cache preferences are very machine-specific, but most are not.

-Kirk